jeudi 9 avril 2015

Spring MVC : Saving a string in servlet-context and accessing from java code

I am working on a Spring-MVC application, in which I have to save a String value which would be required in many other places but from within the java code. I checked out some solutions on net, but I only found how to declare it, not access it.


I require something like this :



<bean id="commontoAllProperty" value="String_value"/>


And access above from java code something similar to this :



class someClass {

private String getValueInBeanWithId(commontoAllProperty);
}


A very vague description but I am going nuts typing that String all the time. Its a FileSystem path by the way. Any help would be nice. Thanks a lot. :-)


Aucun commentaire:

Enregistrer un commentaire