Ibatis - spring pass properties dinamycally



I have this situation:


Ibatis 2.3.5 Spring 3.0.7


A query file query.xml:



<sqlMap namespace="oracle">

<cacheModel type="MEMORY" id="minsCache">
<flushInterval minutes="${pippo}" />
</cacheModel>
<select id="doQuery" resultClass="HashMap" cacheModel="minsCache">
select * from table
</select>
</sqlMap>


and a config file DAOConfig.xml:



<sqlMapConfig>
<properties url="file:<my_path>/test.properties" />
<settings useStatementNamespaces="true" />
<sqlMap resource="dao/oracle/query.xml"/>
</sqlMapConfig>


my test.properties file contains a single value: pippo=1


in my spring application everything works fine with this config, but i would like to pass ${pippo} parameter from my webapp context instead than a properties file. The reason is my test.properties will be outside WAR file and i find wrong referencing it from a file kept inside a WAR (DAOConfig.xml) using absolute path.


My goal would be with a simple stop/start of my application server to set a different cache flushinterval.


I've also used with non results Spring utils namespace to register my properties files inside webapp context, but regardless this successfull operation a can't correctly pass any parameter to my query.xml without setting a properties attribute in DAOConfig.xml file...


ANY succestion??


No comments:

Post a Comment