Issue
I have a java bean that creates an endpoint:
@Bean
public String endpoint() {
return "jdbc" + "a" + "b" + "c";
}
And I want to use that endpoint in my SessionFactory Bean:
<bean id="SessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
parent="AbstractSessionFactory">
<property name="hibernateProperties">
<props>
<prop key="hibernate.connection.url">endpoint</prop>
</props>
</property>
</bean>
How do I wire this up so that I can use it this way?
Solution
It isn't ideal but using "map" instead of "props" I was able to get this to work. You can see full details at the link at the bottom, but my new code is:
@Bean
public String endpoint() {
return "jdbc" + "a" + "b" + "c";
}
<bean id="SessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
parent="AbstractSessionFactory">
<property name="hibernateProperties">
<map>
<entry>
<key>
<value>hibernate.connection.url</value>
</key>
<ref bean="endpoint"/>
</entry>
</map>
</property>
</bean>
http://forum.spring.io/forum/spring-projects/container/55849-referencing-collections-props
Answered By - Oscar Courchaine