How to set the value of context-param in web.xml file from a external properties/XML file when my java web application gets started.
Asked
Active
Viewed 1,161 times
4
-
1I do not think that's possible. – Stefaan Neyts Mar 09 '18 at 06:34
-
1see if you want something that has already been done in https://stackoverflow.com/questions/12099008/how-to-include-values-from-properties-file-into-web-xml – Amit Kumar Lal Mar 09 '18 at 06:35
1 Answers
0
AFAIK web.xml doesn't allow setting context-param from a file, only "static" declaration. That's the spec. You can probably create web.xml dynamically during the build time or something, but the chances are that it's not what you want.
However, you've also tagged "spring"/"spring-mvc" in the question, depending on usage this can open a variety of options for configuration from various sources, but you'll have to be more specific in a question and describe what exactly you want to configure there

Mark Bramnik
- 39,963
- 4
- 57
- 97
-
It is possible to do like below by initializing a ContextListener class
myparam ${my.param}