简体   繁体   中英

Alfresco : Access to properties file from java class

我想知道如何从java class (under alfresco)访问共享下的属性文件, java class (under alfresco)稍后将作为alfresco/lib下的.jar文件导出。

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM