I have legacy spring application which is built using xml based configuration I am trying to configure session factory with second level cache.
I have ecache.xml
file present in resource folder also hibernate.javax.cache.uri
property expects absolute path for ecache.xml
.
if i provide URI as file:///c:/App/resources/ecache.xml
it works. But this is not good for deployments, maintenance.
how can specify relative path like classpath:ehcache.xml
or /WEB-INF/ehcahe.xml
in spring xml based configurations ?
Note: I am not using spring boot.
<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="packagesToScan">
<list>
<value>com.example.vl.model</value>
</list>
</property>
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.javax.cache.uri">file:///c:/App/resources/ecache.xml</prop>
</props>
</property>
</bean>
OK, I am able to get absolute uri in xml based configuration using Spring EL As follows.