Given: a Java EE 5 web app that has a web.xml that has a snippet like
<context-param>
<description>c</description>
<param-name>a</param-name>
<param-value>b</param-value>
</context-param>
What would I need to do to move that context-param specification into an annotation based strategy.
You can find all
javax.servletannotations in thejavax.servlet.annotationpackage summary:You see, there’s nothing like a
@WebContextParam. Which makes also less or more sense; on what kind of class would/could you set it?Some Servlet based frameworks which rely on context parameters, such as JSF, also allows for setting some of them by JNDI. You might want to look into that instead. Or if it concerns homegrown code, then I’d look if
@WebInitParamisn’t a more feasible option for you.