0

I want to know how to access to a properties file that is under share from a java class (under alfresco) which will be exported later as a .jar file under alfresco/lib.

Ethaan
  • 11,291
  • 5
  • 35
  • 45
SSouhaieb
  • 248
  • 5
  • 16

1 Answers1

1

As reported in this Alfresco forum post you should register a Spring bean in your context exploiting the PropertyPlaceholderConfigurer, setting the proper location of you properties file will be found.

<bean id="custom-properties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="ignoreUnresolvablePlaceholders">
        <value>true</value>
    </property>
    <property name="locations">
        <list>
            <value>classpath:alfresco/extension/custom.properties</value>
        </list>
    </property>
</bean>

From now on every time you define a bean you can use placeholders taken from the property file, which has a common key=value format.

abarisone
  • 3,707
  • 11
  • 35
  • 54