在最新的spring-security-oauth2-2.0.6.RELEASE.jar中找不到TokenServicesUserApprovalHandler

时间:2015-02-26 04:17:15

标签: java spring security spring-mvc spring-security

<bean id="userApprovalHandler" class="org.springframework.security.oauth2.provider.approval.TokenServicesUserApprovalHandler">
  <property name="tokenServices" ref="tokenServices" />
</bean>

我的spring-security.xml中的以下代码正在使用spring-security-oauth2-1.0.1.RELEASE.jar但是当我将它升级到spring-security-oauth2-2.0.6.RELEASE.jar时文件,即找不到“org.springframework.security.oauth2.provider.approval.TokenServicesUserApprovalHandler”。

我之所以这样做,是因为以前的jar因为Spring 4.1.X而与jackson有一些冲突。

17:14:53,679 WARN [org.springframework.web.context.support.XmlWebApplicationContext] (MSC service thread 1-1) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.security.oauth2.provider.token.DefaultTokenServices
com.aricent.ans.controller.um.UserController.tokenServices; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenServices' defined in ServletContext resource [/WEB-INF/spring-security.xml]: Cannot
resolve reference to bean 'clientDetails' while setting bean property 'clientDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientDetails' defined in ServletContext resource
[/WEB-INF/spring-security.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.security.oauth2.provider.JdbcClientDetailsService]: Constructor
threw exception; nested exception is java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper

1 个答案:

答案 0 :(得分:6)

这是您正在使用的Spring OAuth2版本的更改。试试这个:

<bean id="userApprovalHandler" class="org.springframework.security.oauth2.provider.approval.TokenStoreUserApprovalHandler">
    <property name="tokenStore" ref="tokenStore"/>
</bean>