title: Going from web.xml to Spring Boot
body: <p>I'm upgrading an existing application to use Spring Boot and to move away from web.xml.
  While I've achieved functionality, there's a portion of my web.xml that for the life of me I cannot figure out how to upgrade to spring boot. (If it matters I'm using 1.5.6)</p>
  
  <p>Relevant portion of my web.xml:</p>
  
  <pre><code>&lt;security-constraint&gt;
      &lt;web-resource-collection&gt;
          &lt;web-resource-name&gt;basic&lt;/web-resource-name&gt;
          &lt;url-pattern&gt;*&lt;/url-pattern&gt;
      &lt;/web-resource-collection&gt;
      &lt;auth-constraint&gt;
          &lt;role-name&gt;User&lt;/role-name&gt;
      &lt;/auth-constraint&gt;
  &lt;/security-constraint&gt;
  
  &lt;login-config&gt;
      &lt;auth-method&gt;BASIC&lt;/auth-method&gt;
      &lt;realm-name&gt;myrealm&lt;/realm-name&gt;
  &lt;/login-config&gt;
  </code></pre>
  
  <p>Here's my application class:</p>
  
  <pre><code>@SpringBootApplication
  public class Application extends SpringBootServletInitializer{
  
  public static void main(String[] args) {
      SpringApplication.run(Application.class, args);
  }
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
           return builder.sources(Application.class);
      }
  }
  </code></pre>
  
  <p>I haven't been able to determine how to set up anything to mirror the functionality of security-constraint or login-config using a code based approach. </p>
  
  <p>If anyone has any ideas of how to or can point me in the right direction, I'd be greatly appreciative. A few hours of googling and trying solutions has left me with nothing.</p>