2015-09-06 26 views

回答

0

我的問題得到了添加以下的依賴後問題:

@Bean 
    public FrameworkEndpointHandlerMapping endpointHandlerMapping() { 
     return new FrameworkEndpointHandlerMapping(); 
    } 
0

的TokenEndpoint bean有允許HttpMethods的列表。現在默認是HttpMethod.POST。不知何故,在TokenEndpoint bean創建後調用setAllowedRequestMethods將解決此問題。我這樣做是爲了解決它在一個項目中:

@Configuration 
public class OAuth2ProviderTokenGetAllowedBackwardsCompatible implements InitializingBean 
{ 
    @Autowired 
    private TokenEndpoint tokenEndpoint; 

    @Override 
    public void afterPropertiesSet() { 
     tokenEndpoint.setAllowedRequestMethods(new HashSet<HttpMethod>() {{ 
      add(HttpMethod.GET); 
      add(HttpMethod.POST); 
     }}); 
    } 
} 
相關問題