春のセキュリティ構成に複数の http ブロックがあります。これは、Spring Security バージョン 3.1 以降で許可されています。この問題は、SpringSocial 構成が RequestCache オブジェクトを自動注入しようとしたときに発生します。次のエラーが表示されます: No qualing Bean of type [org.springframework.security.web.savedrequest.RequestCache] is defined: expected single matching Bean but found 3. 自動配線された RequestCache オブジェクトへの Java コード内の参照を削除すると、 xml 構成に 3 つの http ブロックが含まれていても問題ありません。このエラーを修正する最善の方法は何ですか? 正しい RequestCache を自動配線する方法はありますか?
xml http ブロック:
<http pattern="/oauth/token"...>
</http>
<http pattern="/something/**...>
</http>
<http use-expressions="true"...>
</http>
Java Config には、自動配線された RequestCache への参照があります。
@Bean
public ProviderSignInController providerSignInController(RequestCache requestCache) {
return new ProviderSignInController(connectionFactoryLocator(), usersConnectionRepository(), new SimpleSignInAdapter(requestCache, userService));
}
これらのいずれも、それ自体で問題を引き起こすことはありません。ただし、複数の http ブロックと自動配線された RequestCache があると、次のようになります。
これを正しく設定する方法を教えてくれる人はいますか?