I would like to write an own Resource (from the core.io package) implementation for a custom resource prefix, e.g. "myprotocol:/root/test/foo.properties".
The original idea is to reference an Apache Sling resource path in the JCR repository for loading some properties file which then may be used by the PropertyPlaceholderConfigurer in the Spring application context, e.g.:
<context:property-placeholder properties-ref="appConfig" ignore-unresolvable="true" />
<bean id="appConfig" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>jcr:/app/test/foo.properties</value>
</list>
</property>
</bean>
Does anybody have an idea how to implement this?
Thanks for your help! Oli
Since Spring 4.3 DefaultResourceLoader
now has an addProtocolResolver()
method that allows you to supply an implementation of the ProtocolResolver
interface that takes a String and returns your implementation of ResourceLoader
if you are able to load resources identified by the String value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With