cancel
Showing results for 
Search instead for 
Did you mean: 

Properties in custom-repository.properties via Alfresco API

webdesigner
Champ in-the-making
Champ in-the-making
Hello,

can I access properties defined in the custom-repository.properties via Alfresco-API?

I can simply do something like:

java.util.Properties p = new java.util.Properties();
            p.load(new FileInputStream("custom-repository.properties"));


but may be there is a better way to do it via Alfresco-API?

Best regards
3 REPLIES 3

dhalupa
Champ on-the-rise
Champ on-the-rise
Configuration of which property files are loaded during boot process is done in core-services-context.xml. This configuration can be changed or overriden in your custom config files. After the custom property file is loaded, property value can be injected in your spring bean using following syntax ${property.name}. It has been used extensively in alfresco configuration so there are a lot of examples

Kind regards,

Denis

rivarola
Champ on-the-rise
Champ on-the-rise
Thanks for your reply Denis,

You explained how to inject dependancies in Spring config, but how do you get the property values from Java API ?

dhalupa
Champ on-the-rise
Champ on-the-rise
In the process I have tried to explain it is not dependencies that are getting injected but rather simple string values from loaded property files.

Such method of obtaining property values is used allover alfresco application therefore, I guess, this would be the preffered way to go.

Kind regards,

Denis