How to configure spring-boot with embedded Tomcat to work as a single application?
<p>I have application which after <code>mvn clean package -U tomcat7:run</code> works as soap web service and wsdl is available on: <a href="http://localhost:8080/appservices/ws?wsdl" rel="nofollow noreferrer">http://localhost:8080/appservices/ws?wsdl</a></p>

<p>Now my aim to compile a single jar which will provide web service after execute <code>java -jar service.jar</code>.</p>

<p>As I know spring-boot decides this task.</p>

<p>I created an Application class:</p>

<pre><code>package com.comp.service;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application  extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {

        return application.sources(Application.class);
    }

}
</code></pre>

<p>But after I execute <code>mvn spring-boot:run</code> and call url <a href="http://localhost:8080/appservices/ws?wsdl" rel="nofollow noreferrer">http://localhost:8080/appservices/ws?wsdl</a> I receive:</p>

<pre><code>Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Fri Feb 05 14:54:11 MSK 2016
There was an unexpected error (type=Not Found, status=404).
No message available
</code></pre>

<p>Spring's start log:</p>

<pre><code> .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.2.RELEASE)

2016-02-05 14:43:45.012  INFO 21008 --- [           main] com.comp.service.Application        : Starting Application on PCwith PID 21008 (C:\Users\Maya\git\app-services\target\classes started by Maya in C:\Users\Maya\git\app-services
-services)
2016-02-05 14:43:45.017  INFO 21008 --- [           main] com.comp.service.Application        : No active profile set, falling back to default profiles: default
2016-02-05 14:43:45.117  INFO 21008 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5dc33359: startup date [Fri Feb 05 14:43:45 MSK 2016]; root o
f context hierarchy
2016-02-05 14:43:46.344  INFO 21008 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=fal
se; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; des
troyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; depen
dencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); de
fined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2016-02-05 14:43:47.363  INFO 21008 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-02-05 14:43:47.386  INFO 21008 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
2016-02-05 14:43:47.388  INFO 21008 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.0.30
2016-02-05 14:43:47.555  INFO 21008 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2016-02-05 14:43:47.559  INFO 21008 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2448 ms
2016-02-05 14:43:48.048  INFO 21008 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
2016-02-05 14:43:48.055  INFO 21008 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-02-05 14:43:48.055  INFO 21008 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-02-05 14:43:48.056  INFO 21008 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-02-05 14:43:48.057  INFO 21008 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'requestContextFilter' to: [/*]
2016-02-05 14:43:48.475  INFO 21008 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5dc33359: startup date [Fri Feb 05 14:43:
45 MSK 2016]; root of context hierarchy
2016-02-05 14:43:48.589  INFO 21008 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity&lt;java.util.Map&lt;java.lang.String, java.lang.Object&gt;&gt; org.springframework.boot.autoconfigur
e.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-02-05 14:43:48.592  INFO 21008 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorControlle
r.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-02-05 14:43:48.639  INFO 21008 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-02-05 14:43:48.639  INFO 21008 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-02-05 14:43:48.694  INFO 21008 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-02-05 14:43:48.869  INFO 21008 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2016-02-05 14:43:48.967  INFO 21008 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2016-02-05 14:43:48.972  INFO 21008 --- [           main] com.comp.service.Application        : Started Application in 4.428 seconds (JVM running for 11.125)
2016-02-05 14:44:02.085  INFO 21008 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-02-05 14:44:02.086  INFO 21008 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2016-02-05 14:44:02.107  INFO 21008 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 21 ms
</code></pre>

<p>Where is my problem? In Application.class?</p>

<p>My pom:</p>

<pre><code>&lt;packaging&gt;jar&lt;/packaging&gt;

    &lt;properties&gt;
        &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
        &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
        &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;

        &lt;jdkName&gt;JavaSE-1.7&lt;/jdkName&gt;
        &lt;jdk.version&gt;1.7&lt;/jdk.version&gt;


        &lt;spring-boot.version&gt;1.3.2.RELEASE&lt;/spring-boot.version&gt;
        &lt;spring.version&gt;4.2.4.RELEASE&lt;/spring.version&gt;

    &lt;/properties&gt;
    &lt;build&gt;
        &lt;plugins&gt;
            &lt;plugin&gt;
                &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
                &lt;version&gt;${spring-boot.version}&lt;/version&gt;
                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;repackage&lt;/goal&gt;
                        &lt;/goals&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;

            &lt;plugin&gt;
                &lt;groupId&gt;org.apache.tomcat.maven&lt;/groupId&gt;
                &lt;artifactId&gt;tomcat7-maven-plugin&lt;/artifactId&gt;
                &lt;version&gt;2.2&lt;/version&gt;
                &lt;configuration&gt;
                    &lt;port&gt;8080&lt;/port&gt;

                    &lt;extraDependencies&gt;
                        &lt;dependency&gt;
                            &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                            &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
                            &lt;version&gt;1.7.2&lt;/version&gt;
                        &lt;/dependency&gt;
                        &lt;dependency&gt;
                            &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                            &lt;artifactId&gt;jul-to-slf4j&lt;/artifactId&gt;
                            &lt;version&gt;1.7.2&lt;/version&gt;
                        &lt;/dependency&gt;
                        &lt;dependency&gt;
                            &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
                            &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
                            &lt;version&gt;1.0.7&lt;/version&gt;
                        &lt;/dependency&gt;
                        &lt;dependency&gt;
                            &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
                            &lt;artifactId&gt;logback-core&lt;/artifactId&gt;
                            &lt;version&gt;1.0.7&lt;/version&gt;
                        &lt;/dependency&gt;
                    &lt;/extraDependencies&gt;

                &lt;/configuration&gt;
            &lt;/plugin&gt;
        &lt;/plugins&gt;
    &lt;/build&gt;
    &lt;dependencies&gt;

        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
            &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
            &lt;version&gt;${spring-boot.version}&lt;/version&gt;
        &lt;/dependency&gt;

        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
            &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
            &lt;version&gt;${spring-boot.version}&lt;/version&gt;
            &lt;scope&gt;provided&lt;/scope&gt;
        &lt;/dependency&gt;

        &lt;dependency&gt;
            &lt;groupId&gt;com.sun.xml.ws&lt;/groupId&gt;
            &lt;artifactId&gt;jaxws-rt&lt;/artifactId&gt;
            &lt;version&gt;2.2.10&lt;/version&gt;
        &lt;/dependency&gt;

        &lt;dependency&gt;
            &lt;groupId&gt;org.springframework&lt;/groupId&gt;
            &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
            &lt;version&gt;${spring.version}&lt;/version&gt;
        &lt;/dependency&gt;

    &lt;/dependencies&gt;
&lt;/project&gt;
</code></pre>

<p>Thank you for any advice.</p>

<p><strong>UPDATE</strong></p>

<p>May be problem in web.xml?:</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE web-app PUBLIC "-//Sun Microsystems,
Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd"&gt;

&lt;web-app&gt;
    &lt;listener&gt;
        &lt;listener-class&gt;
            com.sun.xml.ws.transport.http.servlet.WSServletContextListener
        &lt;/listener-class&gt;
    &lt;/listener&gt;
    &lt;servlet&gt;
        &lt;servlet-name&gt;WSServlet&lt;/servlet-name&gt;
        &lt;servlet-class&gt;
            &lt;!--com.sun.xml.ws.transport.http.servlet.WSServlet--&gt;
            org.springframework.web.servlet.DispatcherServlet
        &lt;/servlet-class&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;WSServlet&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/ws&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
    &lt;session-config&gt;
        &lt;session-timeout&gt;120&lt;/session-timeout&gt;
    &lt;/session-config&gt;
&lt;/web-app&gt;
</code></pre>

<p><strong>UPDATE 1:</strong></p>

<p>Application class:</p>

<pre><code>@SpringBootApplication
public class Application  extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}
</code></pre>

<p>Configuration:</p>

<pre><code>@Configuration
@EnableAutoConfiguration

public class AppConfig {

    @Bean
        public EmbeddedServletContainerFactory servletContainer() {
            TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
            factory.setPort(9000);
            factory.setSessionTimeout(10, TimeUnit.MINUTES);
            factory.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/notfound.html"));
            return factory;
        }

    }
</code></pre>

<p><code>spring-boot:run</code> log: </p>

<pre><code>2016-02-08 10:26:19.733  INFO 3976 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2016-02-08 10:26:19.758  INFO 3976 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2016-02-08 10:26:19.990  INFO 3976 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 9000 (http)
2016-02-08 10:26:19.998  INFO 3976 --- [           main] com.comp.service.Application        : Started Application in 5.911 seconds (JVM running for 15.537)
2016-02-08 10:26:53.130  INFO 3976 --- [nio-9000-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-02-08 10:26:53.130  INFO 3976 --- [nio-9000-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2016-02-08 10:26:53.156  INFO 3976 --- [nio-9000-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 26 ms
</code></pre>