I'm using Spring 4.1.1 with pure Java Config (i.e., no web.xml at all). The AnnotationConfigWebApplicationContext has a displayName property, which I assume is analogous to the display-name tag in a web.xml file. However, when I set this property in Java Config, the "Display Name" column in the Tomcat Manager is empty when I deploy the WAR unlike if I would have used the display-name tag in web.xml.
Is this the intended behavior or am I doing something wrong. I'm using the latest version of Tomcat which is 7.0.57, Java 1.7 u51, and Groovy 2.3.7.
@Slf4j
class WebAppInitializer implements WebApplicationInitializer {
{
@Override
void onStartup(ServletContext container) throws ServletException {
def rootContext = new AnnotationConfigWebApplicationContext()
rootContext.register(WebAppConfig)
rootContext.servletContext = container
rootContext.displayName = 'Description of WAR goes here!'
DispatcherServlet dispatcherServlet = new DispatcherServlet(rootContext)
dispatcherServlet.throwExceptionIfNoHandlerFound = true
def dispatcherServletReg = container.addServlet('dispatcher', dispatcherServlet)
dispatcherServletReg.addMapping('/')
dispatcherServletReg.loadOnStartup = 1
}
}
Thanks ahead of time for any help.