クラスが同じで修飾子名が異なる 2 つの Bean を作成する際に問題があります。基本的に、1 つの Bean はアノテーション @Repository で作成され、もう 1 つの Bean は @Configuration クラス内で作成されます。
これは、異なるデータソースを持つ 2 つのインスタンスを使用しないクラスです。
@Repository ("someDao")
public class SomeDaoImpl implements SomeDao {
    private NamedParameterJdbcTemplate jdbcTemplate;
    @Autowired
    public void setDataSource(DataSource dataSource) {
        jdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
    }
}
そして、次のようなサービスがあります。
@Service
public class SomeServiceImpl implements
        SomeService {
    @Resource(name = "someDao")
    private SomeDao someDao;
    @Resource(name = "someDaoAnotherDataSource")
    private SomeDao someDaoAnotherDataSource;
}
私の最初の Bean はアノテーション @Repository によって作成され、もう 1 つの Bean は Spring 構成クラスで宣言しました。
@Configuration
@ComponentScan(basePackages = "mypackages")
public abstract class ApplicationRootConfiguration {
    @Bean(name = "otherDataSource")
    public DataSource otherDataSource() throws NamingException {
    ...
    }
    @Bean(name = "someDaoAnotherDataSource")
    public SomeDao getSomeDaoAnotherDataSource(@Qualifier("otherDataSource")
     DataSource dataSource) throws NamingException {
        SomeDao dao = new SomeDaoImpl();
        dao.setDataSource(dataSource);
        return dao;
    }
}
アプリケーションを実行すると、 SomeServiceImpl のプロパティ someDaoAnotherDataSource には、構成クラスで宣言された Bean がありません。注釈リポジトリで宣言された Bean があります。
また、XML 構成で同じ例を実行すると、次のように動作します。
<bean id="someDaoAnotherDataSource"     class="SomeDaoImpl">
    <property name="dataSource" ref="otherDataSource" />
</bean>
自動配線が適切な Bean ではない理由は何ですか?
前もって感謝します。