<bean id="groupContainerRelationshipDAO" class="containermanager.management.dao.GroupContainerRelationshipDAOImpl">
<property name="dataSource">
<util:property-path path="dataSourceFactory.dataSource" />
</property>
</bean>
我想将其定义为 spring 注释。问题是 dataSource 是继承类 SimpleJdbcDaoSupport 的成员。有人知道怎么做吗?
最佳答案
这个:
@Component
class GroupContainerRelationshipDAOImpl {
@Value("#{dataSourceFactory.dataSource}")
private DataSource dataSource;
}
了解有关@Value
注释的更多信息:http://docs.spring.io/spring/docs/current/spring-framework-reference/html/beans.html#beans-annotation-config
关于java - 具有 util :property-path as annotation 的 Spring 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25117778/