Note that there are some explanatory texts on larger screens.

plurals
  1. POSetting webapprootkey no-web.xml
    primarykey
    data
    text
    <p>I'm migrating a web app to Spring 3.2 and am enjoying the web.xml-free configuration. One part that's remaining is setting the webapp root key, which I previously did in web.xml like so:</p> <pre><code>&lt;context-param&gt; &lt;param-name&gt;webAppRootKey&lt;/param-name&gt; &lt;param-value&gt;webapproot&lt;/param-value&gt; &lt;/context-param&gt; </code></pre> <p>I know that Spring creates a default key, but in my case I'm running multiple versions of the same war and need to set the key to a different value in each. So optimally I'd like to take a value from a properties file and use that as the rootkey.</p> <p>I imagine that I would do this somewhere here:</p> <pre><code>public class WebAppInitializer implements WebApplicationInitializer { private static final Logger logger = Logger.getLogger(WebAppInitializer.class); @Override public void onStartup(ServletContext servletContext) throws ServletException { // Create the root appcontext AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext(); rootContext.register(AppConfig.class); servletContext.addListener(new WebAppRootListener()); // Manage the lifecycle of the root appcontext servletContext.addListener(new ContextLoaderListener(rootContext)); //servletContext.setInitParameter("defaultHtmlEscape", "true"); // The main Spring MVC servlet. ServletRegistration.Dynamic springapp = servletContext.addServlet( "springapp", new DispatcherServlet(rootContext)); springapp.setLoadOnStartup(1); Set&lt;String&gt; mappingConflicts = springapp.addMapping("/"); ...etc... </code></pre> <p>Thanks to anyone who can offer advice!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload