Could not autowire. There is more than one bean of 'DataSource' type

前端 未结 3 1765
失恋的感觉
失恋的感觉 2021-02-01 18:06

I\'m trying to Autowire a database by

@Autowired
private DataSource dataSource;

I have one datasource in my application.yml

3条回答
  •  时光取名叫无心
    2021-02-01 18:11

    I solved by adding qualifier above the property:

    @Autowired
    @Qualifier("dataSource")
    private DataSource dataSource;
    

提交回复
热议问题