Spring SecurityからJdbcUserDetailsManagerを自動配線しようとすると、appcontext.xml(webappとは別に配置)で次のステートメントを使用します。
<bean class="org.springframework.security.provisioning.JdbcUserDetailsManager">
<property name="dataSource" ref="dataSource"/>
</bean>
ユニットテストを実行するときは、すべて問題ありません。元のappcontext.xmlを含む独自のappcontext.xmlを持つWebアプリを起動すると、重複するエラーが発生します。
No unique bean of type
[org.springframework.security.provisioning.JdbcUserDetailsManager] is defined:
expected single matching bean but found 2:
[org.springframework.security.provisioning.JdbcUserDetailsManager#0,
org.springframework.security.provisioning.JdbcUserDetailsManager#1]
2つのappcontext.xmlを改良して、サービスレイヤーテストとWebアプリの両方をそれぞれ実行するにはどうすればよいですか?