java - externalizing terracottaconfig property in ehcache.xml file inside Spring framework -
there tag <terracottaconfig url="host1:9510,host2:9510,host3:9510"/>
in ehcache.xml file inside spring web application. want externalize url attribute of tag. value of url should replaced property external file. helpful if suggest solution problem.
you can put - <terracottaconfig url="${terracotta.config.location}" />
, big catch loaded from system properties. not resolved propertyplaceholder not spring configuration file.
so if want use external config file, have programatically set system property before spring application starts loading ehcache.xml file - 1 way write custom servletcontextlistener load properties file , set system property based on that, way when ehcache.xml loaded able resolve place holder properly.
your answer helped me solve problem. want add instead of setting system property through program, using util:properties follows
<bean id="sysproperties" class="org.springframework.beans.factory.config.methodinvokingfactorybean"> <property name="targetobject" value="#{@systemproperties}"/> <property name="targetmethod" value="putall"/> <property name="arguments"> <util:properties> <prop key="propertyname_used_in_ecache_xml">#{proerties_defined_using_property_factory['propertyname_defined_in_external_properties_file']}</prop> </util:properties> </property> </bean> <bean id="cachemanager" class="org.springframework.cache.ehcache.ehcachemanagerfactorybean" depends-on="sysproperties"> <property name="configlocation"> <value>classpath:ehcache.xml</value> </property> </bean>
Comments
Post a Comment