@ContextConfiguration : 웹 서버를 돌리지않고 webApp 구현체를 만들어주는 역할
@WebAppConfig 붙어야 웹앱 됨.
@Transactional. Advisor가 테스트 케이스에 위빙됨, 자동커밋됨
@ControllerAdvice
모든 컨트롤러를 대상으로 weaving된다. 컨트롤러가 동작할 땐 언제나 얘가 계속 조회된다.
multipartfile: 비어있는 멀티파트 걸러지지않음. 첨부파일 추가하지 않아도 채워져버림.
=> 커맨드오브젝트의 책임은 핸들러어댑터가 진다. 데이터바인드 설정만 바꿔주면 비어있는 파트 해결 가능함.
BUT 게시판에서 3개의 첨부파일이 1개의 동일한 input 태그를 쓰고있어서 데이터바인드가 동작하지 못하고 있음. -> 다른 방법을 찾아야함.
@ControllerAdvice
public class OthersRetrieveControllerAdvice {
@Inject
IOthersDAO othersDAO;
@ModelAttribute("lprodList")
public List<Map<String, Object>> getLprodList() {
return othersDAO.selectLprodGuList();
}
@ModelAttribute("buyerList")
public List<BuyerVO> getBuyerList(){
return othersDAO.selectBuyerList();
}
@InitBinder
public void dataBind(WebDataBinder webDataBinder) {
webDataBinder.setBindEmptyMultipartFiles(false);
}
}
'JAVA > Spring Framework' 카테고리의 다른 글
스프링 시큐리티 (0) | 2020.11.23 |
---|---|
Spring Framework 에서 Quartz 이용하여 파라미터 있는 스케쥴러 구현 (0) | 2020.11.23 |
추상 클래스로 view 만들기, properties 파일 사용해 폴더 위치 지정하기 (0) | 2020.10.13 |
알바 관리 메이븐 프로젝트에 Spring 적용하기 (0) | 2020.10.12 |
스프링 프레임워크 AOP (0) | 2020.10.12 |