#Java - Code Snippets for '#Spring' - 5 code snippet(s) found |
|
Sample 1. Check if the string is empty using Spring StringUtils | |
|
String str = "";
if(StringUtils.isEmpty(str)){
System.out.println("Yes, string is empty");
}
|
|
Like Feedback StringUtils StringUtils.isEmpty |
|
|
Sample 2. Controller in Spring MVC | |
|
@Controller
@RequestMapping("/employee")
public class EmployeeInfoController {
@RequestMapping(value = "", method = RequestMethod.GET)
public Model searchEmployeeInfo(Model model, @RequestParam("id") String employeeId) {
// body
}
}
|
|
Like Feedback controller @Controller @RequestMapping RequestMethod.GET @RequestParam Spring mvc spring framework |
|
|
Sample 3. RabbitMQ message receiver | |
|
import java.util.concurrent.CountDownLatch;
public class Receiver {
private CountDownLatch latch = new CountDownLatch(1);
public void receiveMessage(String message) {
latch.countDown();
}
public CountDownLatch getLatch() {
return latch;
}
}
|
|
Like Feedback Spring AMQP Rabbit MQ RabbitMQ |
|
|
Sample 4. Usage of org.springframework.security.web.util.matcher.RequestMatcher | |
|
RequestMatcher matcher = new RegexRequestMatcher("(.*/(html|php|htm)/.*)", RequestMethod.GET.name());
registry.addInterceptor(new MyInterceptor(matcher));
|
|
Like Feedback rg.springframework.security.web.util.matcher.RequestMatche |
|
|
|
Sample 5. Usage of
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.context.annotation.Bean;
import org.springframework.web.multipart.MultipartResolver; | |
|
@EnableWebMvc
@Configuration
public class Application extends WebMvcConfigurerAdapter {
@Bean
public MultipartResolver multipartResolver() {
CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
multipartResolver.setMaxUploadSize(500000);
return multipartResolver;
}
}
|
|
Like Feedback Usage of MultipartResolver multipartResolver.setMaxUploadSize(500000) Setting max file size using Spring multipartResolver |
|
|