@Controller , @Service 등등 스프링 MVC를 어노테이션으로 설정하려면 설정파일에서 
<context:annotation-config />와 <context:component-scan base-package="com.ncos">을 명시해 주어야 하는 것은 이미 알고 있는 사실이다. 헌데, component-scan의 옵션을 어떻게 주느냐에 따라 삽질 여부가 결정된다..ㅡ.ㅡ;

일단 가장 심플한 베스트 프랙티스는,

<context:annotation-config />
<context:component-scan base-package="com.ncos" />

요거 딱 두 줄이다.

기존 프로젝트에 있는 소스를 복사해서 쓰다보니까 어떤 의미인지도 모른 채 쓰게 되었는데, 결국 삽질을 맛보게 되었다.

<context:component-scan base-package="com.ncos" use-default-filters="false">
    <context:include-filter type="annotation" 
        expression="org.springframework.stereotype.Controller" />
</context:component-scan>
처음엔 이렇게 설정했는데 이것은  "@Controller를 등록한 빈만 컴포넌트 스캔" 한다는 뜻이다.(springsprout.)

@Autowired를 선언하는 과정에서 오류가 났다. 로그를 보니 빈을 찾을 수 없다나 생성할 수 없다나 하는 내용.
설정 파일들의 컴포넌트 스캔 부분을 살펴 본 결과, 위와 같이 수정 후 정상적으로 작동되었다.




AND