[BAEL-15393] - Update Spring File Upload article
This commit is contained in:
@@ -23,15 +23,15 @@ public class LoggingAspect {
|
||||
}
|
||||
};
|
||||
|
||||
@Pointcut("@target(org.springframework.stereotype.Repository)")
|
||||
@Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.*(..))")
|
||||
public void repositoryMethods() {
|
||||
}
|
||||
|
||||
@Pointcut("@annotation(com.baeldung.aop.annotations.Loggable)")
|
||||
@Pointcut("within(com.baeldung..*) && @annotation(com.baeldung.aop.annotations.Loggable)")
|
||||
public void loggableMethods() {
|
||||
}
|
||||
|
||||
@Pointcut("@args(com.baeldung.aop.annotations.Entity)")
|
||||
@Pointcut("within(com.baeldung..*) && @args(com.baeldung.aop.annotations.Entity)")
|
||||
public void methodsAcceptingEntities() {
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ public class PerformanceAspect {
|
||||
|
||||
private static Logger logger = Logger.getLogger(PerformanceAspect.class.getName());
|
||||
|
||||
@Pointcut("within(@org.springframework.stereotype.Repository *)")
|
||||
@Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.*(..))")
|
||||
public void repositoryClassMethods() {
|
||||
}
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ public class PublishingAspect {
|
||||
this.eventPublisher = eventPublisher;
|
||||
}
|
||||
|
||||
@Pointcut("@target(org.springframework.stereotype.Repository)")
|
||||
@Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.*(..))")
|
||||
public void repositoryMethods() {
|
||||
}
|
||||
|
||||
@Pointcut("execution(* *..create*(Long,..))")
|
||||
@Pointcut("within(com.baeldung..*) && execution(* com.baeldung.dao.FooDao.create*(Long,..))")
|
||||
public void firstLongParamMethods() {
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.springframework.context.support.ResourceBundleMessageSource;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||
import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
|
||||
@@ -63,7 +62,7 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
final SpringResourceTemplateResolver templateResolver = new SpringResourceTemplateResolver();
|
||||
templateResolver.setPrefix("/WEB-INF/templates/");
|
||||
templateResolver.setSuffix(".html");
|
||||
templateResolver.setTemplateMode("HTML5");
|
||||
templateResolver.setTemplateMode("HTML");
|
||||
return templateResolver;
|
||||
}
|
||||
|
||||
@@ -87,15 +86,6 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
|
||||
}
|
||||
|
||||
@Bean(name = "multipartResolver")
|
||||
public CommonsMultipartResolver multipartResolver() {
|
||||
|
||||
final CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver();
|
||||
multipartResolver.setMaxUploadSize(100000);
|
||||
|
||||
return multipartResolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void extendMessageConverters(final List<HttpMessageConverter<?>> converters) {
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
spring.servlet.multipart.max-file-size=10MB
|
||||
spring.servlet.multipart.max-request-size=10MB
|
||||
spring.http.multipart.enabled=true
|
||||
spring.servlet.multipart.location=${java.io.tmpdir}
|
||||
|
||||
logging.level.org.springframework=DEBUG
|
||||
logging.level.com.baeldung=DEBUG
|
||||
|
||||
#output to a temp_folder/file
|
||||
logging.file=${java.io.tmpdir}/application.log
|
||||
|
||||
# Logging pattern for the console
|
||||
logging.pattern.console= %d{yyyy-MM-dd HH:mm:ss} - %msg%n
|
||||
|
||||
# Logging pattern for file
|
||||
logging.pattern.file= %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%
|
||||
spring.http.encoding.charset=UTF-8
|
||||
# Enable http encoding support.
|
||||
spring.http.encoding.enabled=true
|
||||
# Force the encoding to the configured charset on HTTP requests and responses.
|
||||
spring.http.encoding.force=true
|
||||
server.servlet.context-path=/spring-mvc-java
|
||||
spring.servlet.multipart.max-file-size=1MB
|
||||
spring.servlet.multipart.max-request-size=1MB
|
||||
spring.servlet.multipart.enabled=true
|
||||
spring.servlet.multipart.location=${java.io.tmpdir}
|
||||
Reference in New Issue
Block a user