mercredi 18 mars 2015

In Spring how to concatenate result of a static method during injection

During bean injection, I would like to take a return value from static method of a class and concatenate with something else to form a file location. Is there a way to do this in spring ?


Here is the static class



public class MyEnv{

public static String getRoot(){
return "/u1/temp/"
}
}


I want to do something like this:



<bean id="MyBean" class = "com.app.test.FileLoader">
<property name="fileLocation" value = "#{'MyEnv.getRoot()'+'testfile.txt'}">
</bean>


Is this possible? Thanks for your help.


Aucun commentaire:

Enregistrer un commentaire