2011-10-24 1 views
1

나는 내 응용 프로그램에서 oauth2 클래스 org.springframework.security.oauth2.provider.endpointSpring 파견 서블릿에서 <context : component-scan />을 구성하는 방법은 무엇입니까?

@RequestMapping(value = "/oauth/authorize", method = RequestMethod.POST) 
public void approveOrDeny(@RequestParam("user_oauth_approval") 
          boolean approved, 
          HttpServletRequest request, 
          HttpServletResponse response) throws IOException, 
                   ServletException { 
.... 
} 

의 컨트롤러 메서드를 호출합니다. 위의 클래스를 호출하기 위해이 함수를 사용했다. 결과는 "액세스 할 수 없음"이었습니다.

<context:component-scan base-package="org.stjude.ri.bwfp"> 
    <context:include-filter type="regex" expression="org.springframework.security.oauth2.*"/> 
    <context:exclude-filter expression=".*_Roo_.*" 
     type="regex" /> 
    <context:exclude-filter expression="org.springframework.stereotype.Controller" 
     type="annotation" /> 
</context:component-scan> 

org.springframework.security.oauth2.provider.*에서 컨트롤러 클래스 메서드를 어떻게 호출 할 수 있습니까?

+0

다음 대답은 또한 도움이 될 수 있습니다 : ([@Service 두 번 구성된다] http://stackoverflow.com/a/4335438/814702) – informatik01

답변

3

dispatcher-servlet beans는 일반적으로 @Controller이어야하므로이를 제외하면 안됩니다. 우리는 OAuth를 함께, 우리의 dispatcher-servlet.xml이 하나를 사용하고 잘 작동 :

<context:component-scan base-package="foo.bar.controllers" use-default-filters="false"> 
    <context:include-filter expression="org.springframework.stereotype.Controller" type="annotation"/> 
</context:component-scan> 
관련 문제