XML サーブレット構成を Java 構成に移行しようとしています。
以下の構成は私のサーブレット構成であり、コントローラー層でカスタム セキュリティ アノテーションを有効にします。
<security:global-method-security pre-post-annotations="enabled">
<security:expression-handler ref="expressionHandler"/>
</security:global-method-security>
<bean id="expressionHandler" class="yyy.MyMethodSecurityExpressionHandler" />
また、Spring Security xml 構成が機能しています。これは、Java 構成に置き換えるためのものですが、今はそうではありません。ここに私のセキュリティ設定のいくつかの部分があります:
<bean id="authenticationProvider" class="org.springframework.security.authentication.dao.DaoAuthenticationProvider">
<property name="userDetailsService" ref="userDetailsService" />
</bean>
<bean id="authenticationManager" class="org.springframework.security.authentication.ProviderManager">
<constructor-arg>
<ref bean="authenticationProvider"/>
</constructor-arg>
</bean>
<security:authentication-manager>
<security:authentication-provider user-service-ref="userDetailsService" />
</security:authentication-manager>
<security:global-method-security pre-post-annotations="enabled" />
コントローラ層でセキュリティとタグを有効にするサーブレット構成の移行を開始したいと考えています。@PreAuthorize
@PostAuthorize
私はこの注釈を見つけました: @EnableGlobalMethodSecurity(prePostEnabled=true)
、しかしそれを私のサーブレット設定に入れます:
@Configuration
@ComponentScan(basePackages= {
"....."
})
@EnableGlobalMethodSecurity(prePostEnabled=true)
public class WebappServletConfig extends WebMvcConfigurationSupport {
私はこの例外を受け取ります:
java.lang.IllegalArgumentException: Expecting to only find a single bean for type interface org.springframework.security.authentication.AuthenticationManager, but found []
さらに、カスタムの式ハンドラーを設定する方法がわかりません!
ヒントのある人?ありがとうございました