Hello all!
I've got a hibernate configuration file called hibernate.cfg.xml. In this file there are hard-coded property names like:
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">mysecretpassword</property>
...
</session-factory>
</hibernate-configuration>
I want to swap out things like the username and the password to a ".properties"-file. So that I will get the following:
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.username">${jdbc.username}</property>
<property name="hibernate.connection.password">${jdbc.password}</property>
...
</session-factory>
</hibernate-configuration>
How can I do that? For the dataSource in Spring I can use this one in my applicationContext.xml:
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
p:location="/WEB-INF/jdbc.properties" />
What is the equivalent for Hibernate? Does anybody know this?
Best wishes
Benny