-
Notifications
You must be signed in to change notification settings - Fork 64
Setting Up Spring Java
Ralph Schaer edited this page Jul 10, 2012
·
1 revision
A setup with JavaConfig still needs the DispatcherServlet described here.
The rest of the configuration is a translation of the XML Setup.
@Configuration
@EnableWebMvc
@ComponentScan(basePackages = "ch.ralscha.extdirectspring"}
public class WebConfig {
@Bean
public MultipartResolver multipartResolver() {
CommonsMultipartResolver resolver = new CommonsMultipartResolver();
resolver.setMaxUploadSize(100000);
return resolver;
}
//some more configuration
}
The MultipartResolver is only needed for file uploads. The CommonsMultipartResolver needs two additional libraries (commons-fileupload and commons-io)
On a Servlet 3.0 container you could use the StandardServletMultipartResolver. The two libraries commons-fileupload and commons-io are no longer needed.
@Bean
public MultipartResolver multipartResolver() {
return new StandardServletMultipartResolver();
}
If you use this configuration don't forget to enable multipart support on the DispatcherServlet ({{{}}}). See XML Setup.
- Introduction
- Changelog 1.7.x
- Setup Maven
- Configuration
- Server Methods
- Model Generator
- Model Generator APT
- Development
- Links