【问题标题】:Spring property with util:property-path as annotation使用 util:property-path 作为注解的 Spring 属性
【发布时间】:2014-08-04 11:37:17
【问题描述】:
<bean id="groupContainerRelationshipDAO" class="containermanager.management.dao.GroupContainerRelationshipDAOImpl">
   <property name="dataSource">
      <util:property-path path="dataSourceFactory.dataSource" />
   </property>
</bean>

我想将此定义为弹簧注解。问题是 dataSource 是继承类 SimpleJdbcDaoSupport 的成员。有人知道怎么做吗?

【问题讨论】:

  • 你在使用休眠吗?

标签: java spring dao


【解决方案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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-19
    • 2012-08-06
    • 1970-01-01
    • 2015-05-03
    • 1970-01-01
    • 2015-07-03
    • 2017-04-25
    • 2013-01-15
    相关资源
    最近更新 更多