<bean id="groupContainerRelationshipDAO" class="containermanager.management.dao.GroupContainerRelationshipDAOImpl">
<property name="dataSource">
<util:property-path path="dataSourceFactory.dataSource" />
</property>
</bean>
我想将此定义为spring注释。问题是dataSource是继承类SimpleJdbcDaoSupport的成员。有人知道怎么做吗?
答案 0 :(得分:1)
这一个:
@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