- 파일첨부 기능 적용
- WebConfig.java
package works.yermi.config;
// import 생략
public class WebConfig extends AbstractAnnotationConfigDispatcherServletInitializer{
// 코드 생략
@Override
protected void customizeRegistration(Dynamic registration) {
MultipartConfigElement element =
new MultipartConfigElement("c:/upload", 1024 * 1024 * 2 * 10, 1024 * 1024 * 4 * 10, 1024 * 1024 * 2 * 10);
registration.setMultipartConfig(element);
}
}
- ServletConfig.java
package works.yermi.config;
// import 생략
@Configuration
@EnableWebMvc
@ComponentScan("works.yermi.controller")
@EnableGlobalMethodSecurity(prePostEnabled=true)
public class ServletConfig implements WebMvcConfigurer{
// 코드 생략
@Bean
public MultipartResolver multipartResolver() {
return new StandardServletMultipartResolver();
}
}
- 403 에러 해결 방법