First, in your Spring applications "applicationContext.xml" (or whatever you named it:), add a property placeholder like this:
<context:property-placeholder local-override="true" ignore-resource-not-found="true"/>
Optional parameter of "location" could be added if you would also like to load some values found in .properties files. ( location="WEB-INF/my.properties" for example).
The important attribute to remember is the 'local-override="true"' attribute, which tells the place holder to use context parameters if it can't find anything in the loaded properties files.
Then in your constructors and setters you can do the following, using the @Value annotation and SpEL(Spring Expression Language):
@Component
public class AllMine{
public AllMine(@Value("${stuff}") String stuff){
//Do stuff
}
}
This method has the added benefit of abstracting away from the ServletContext, and gives you the ability to override default context-param values with custom values in a properties file.
Hope that helps:)