2013-07-09 1 views
0

org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping detectHandlers를 끄는 방법, 스프링 3 시작을 디버그 모드에 넣습니다. 모든 클래스는 'detectHandlers'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping detectHandlers를 끄기

예를

[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping detectHandlers org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping.detectHandlers(AbstractDetectingUrlHandlerMapping.java:86)] - Rejected bean name 'org.springframework.security.authenticationManager': no URL paths identified 

[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping detectHandlers org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping.detectHandlers(AbstractDetectingUrlHandlerMapping.java:86)] - Rejected bean name 'systemProperties': no URL paths identified 

[org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping detectHandlers org.springframework.web.servlet.handler.AbstractDetectingUrlHandlerMapping.detectHandlers(AbstractDetectingUrlHandlerMapping.java:86)] - Rejected bean name 'systemEnvironment': no URL paths identified 

단지 내 "컨트롤러"클래스가 핸들러를 호출하고 다른 모든 클래스가 없습니다. 나는 봄 시작을 가속화하려고 노력하고있다. 어쨌든 모든 클래스에 대해이 자동 감지 처리기 기능을 해제 하시겠습니까?

답변

1

당신은 불필요한 클래스 using filters를 건너 뛸 수 있습니다 : 나를 위해

<beans> 

    <context:component-scan base-package="org.example"> 
     <context:exclude-filter type="regex" expression=".*NotControllerBean"/> 
    </context:component-scan> 

</beans> 

가장 perfomant과 맑은 용액 전용 패키지에 컨트롤러를 이동하고 구성 요소를 스캔 만이 패키지를 사용합니다.

+0

은 componenet-scan exclude가 아닌 모든 bean을 제외하도록 xml에서 DefaultAnnotationHandlerMapping을 구성 할 수 있습니까? – cometta

+0

나는 그것을 할 수 없다고 생각합니다. –

1

는 "단지 내"컨트롤러 "클래스는 핸들러가 다른 모든 클래스는 없습니다"

당신은 맞다. 그리고 클래스가 컨트롤러인지 알아보기 위해서는 Spring이 그것을 체크해야합니다. 그리고 정확히 여기에서 볼 수 있습니다. 스프링은 유형 수준에서 @Controller 또는 @RequestMapping의 존재를 찾습니다.