MyBatis에서는 SQL을 동적으로 처리 할 수 있다. 저장 프로시저(stored procedure)를 활용해도 되지만 MyBatis에서 제공하는 기능을 사용해보자. if select * from search_list where seq = #{seq} and title = #{title} and contents = #{contents} if의 조건에 맞지 않으면 select * from search_list where seq = #{seq} title 값이 있으면 select * from search_list where seq = #{seq} and title = #{title} title 과 contents 값이 있으면 select * from search_list where seq = #{seq} ..

Spring의 실행 순서 Controller -> Service -> DAO -> DB -> DAO -> Service -> Controller 에러 없이 마지막 Controller에서 null 값이 출력된다면 1. DB에서 mapper에 있는 쿼리를 실행해서 원하는 값이 출력되는지 확인한다. 2. DAO, Serivce에서 값이 넘어갔는지 확인해본다. Service, DAO에 값이넘어오지 않았다면, 의존성 주입이 제대로 수행되지 않은 것이다. @어노테이션(Annotation)을 확인해 볼 필요가 있다. (누락된 곳이 있는지, 올바르게 작성되었는지 .. ) 어노테이션 주의점 다음과 같이 작성하면 의존성 주입이 되지 않는다. @Autowired private MainDAO dao1; private Boar..