1

I want to call a controller method in oauth2 class org.springframework.security.oauth2.provider.endpoint

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

from my application. To call the above class I tried using this. The result was "unable to access".

<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>

How can I call the controller class methods in org.springframework.security.oauth2.provider.*?

informatik01
  • 16,038
  • 10
  • 74
  • 104
user1010423
  • 11
  • 1
  • 2
  • The following answer also can be helpful: [@Service are constructed twice](http://stackoverflow.com/a/4335438/814702) – informatik01 May 12 '15 at 20:13

1 Answers1

3

Since dispatcher-servlet beans should normally be @Controllers only, you should not exclude them. We are using this one in our dispatcher-servlet.xml, with OAuth, and it works fine:

<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>
Bozho
  • 588,226
  • 146
  • 1,060
  • 1,140