0
我datasource
自動裝配與setter方法。嘗試在Spring javaconfig文件中返回datasource
值與Bean聲明。由於某種原因,它不能識別並顯示錯誤:不能設定值自動裝配Autowired參數
Property 'dataSource' required
任何想法?下面是我在javaconfig文件豆:
@Bean(name = "dataSource")
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("org.hsqldb.jdbcDriver");
dataSource.setUrl("xyz");
dataSource.setUsername("xyz");
dataSource.setPassword("xyz");
return dataSource;
}
和日誌跟蹤:
Error creating bean with name 'featureStoreSpringJDBC' defined
in URL [jar:file:/C:home/WEB-INF/lib/ff4j-store-springjdbc.jar!
/org/ff4j/store/FeatureStoreSpringJDBC.class]:
Initialization of bean failed; nested exception
is org.springframework.beans.factory.BeanInitializationException
Property 'dataSource' is required for bean 'featureStoreSpringJDBC'
請添加您的bean配置,以及錯誤堆棧跟蹤 – mvlaicevich