web-dev-qa-db-fra.com

Impossible d'instancier la classe d'usine: org.springframework.boot.autoconfigure.AutoConfigurationImportFilter "lors de l'exécution de l'application Spring Boot sur Tomcat

Je suis un débutant sur Spring Boot. Je viens de construire un exemple Spring Boot en suivant le tutoriel Spring Boot sur le site officiel, puis déployé sur le format Tomcat avec WAR, j'ai les erreurs ci-dessous quand il commence à s'exécuter:

2017-03-01 09:26:17.838  INFO 12568 --- [ost-startStop-1] hello.SpringBootWebApplicationTest       : No active profile set, falling back to default profiles: default
2017-03-01 09:26:18.116  INFO 12568 --- [ost-startStop-1] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3c164927: startup date [Wed Mar 01 09:26:18 CST 2017]; root of context hierarchy
2017-03-01 09:26:19.015  WARN 12568 --- [ost-startStop-1] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [hello.SpringBootWebApplicationTest]; nested exception is Java.lang.IllegalArgumentException: Cannot instantiate factory class: org.springframework.boot.autoconfigure.AutoConfigurationImportFilter
2017-03-01 09:26:19.044 ERROR 12568 --- [ost-startStop-1] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [hello.SpringBootWebApplicationTest]; nested exception is Java.lang.IllegalArgumentException: Cannot instantiate factory class: org.springframework.boot.autoconfigure.AutoConfigurationImportFilter
    at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.Java:461) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.Java:185) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.Java:321) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.Java:243) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.Java:273) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.Java:98) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.Java:678) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:520) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.Java:122) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:737) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.Java:370) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:314) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.Java:152) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.Java:132) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.Java:87) [spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.Java:175) [spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.Apache.catalina.core.StandardContext.startInternal(StandardContext.Java:5303) [catalina.jar:8.0.39]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:145) [catalina.jar:8.0.39]
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1408) [catalina.jar:8.0.39]
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1398) [catalina.jar:8.0.39]
    at Java.util.concurrent.FutureTask.run(FutureTask.Java:266) [na:1.8.0_60]
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142) [na:1.8.0_60]
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617) [na:1.8.0_60]
    at Java.lang.Thread.run(Thread.Java:745) [na:1.8.0_60]
Caused by: Java.lang.IllegalArgumentException: Cannot instantiate factory class: org.springframework.boot.autoconfigure.AutoConfigurationImportFilter
    at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.Java:138) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.core.io.support.SpringFactoriesLoader.loadFactories(SpringFactoriesLoader.Java:91) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getAutoConfigurationImportFilters(AutoConfigurationImportSelector.Java:279) ~[spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.filter(AutoConfigurationImportSelector.Java:250) ~[spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.selectImports(AutoConfigurationImportSelector.Java:101) ~[spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.Java:453) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    ... 23 common frames omitted
Caused by: Java.lang.IllegalAccessException: Class org.springframework.core.io.support.SpringFactoriesLoader can not access a member of class org.springframework.boot.autoconfigure.condition.OnClassCondition with modifiers ""
    at Sun.reflect.Reflection.ensureMemberAccess(Reflection.Java:102) ~[na:1.8.0_60]
    at Java.lang.Class.newInstance(Class.Java:436) ~[na:1.8.0_60]
    at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.Java:135) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    ... 28 common frames omitted

2017-03-01 09:26:19.050 ERROR 12568 --- [ina-startStop-1] org.Apache.catalina.core.ContainerBase   : A child container failed during start

Java.util.concurrent.ExecutionException: org.Apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/springrestdemo]]
    at Java.util.concurrent.FutureTask.report(FutureTask.Java:122) [na:1.8.0_60]
    at Java.util.concurrent.FutureTask.get(FutureTask.Java:192) [na:1.8.0_60]
    at org.Apache.catalina.core.ContainerBase.startInternal(ContainerBase.Java:943) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.core.StandardHost.startInternal(StandardHost.Java:871) [catalina.jar:8.0.39]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:145) [catalina.jar:8.0.39]
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1408) [catalina.jar:8.0.39]
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1398) [catalina.jar:8.0.39]
    at Java.util.concurrent.FutureTask.run(FutureTask.Java:266) [na:1.8.0_60]
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142) [na:1.8.0_60]
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617) [na:1.8.0_60]
    at Java.lang.Thread.run(Thread.Java:745) [na:1.8.0_60]
Caused by: org.Apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/springrestdemo]]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:162) [catalina.jar:8.0.39]
    ... 6 common frames omitted
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [hello.SpringBootWebApplicationTest]; nested exception is Java.lang.IllegalArgumentException: Cannot instantiate factory class: org.springframework.boot.autoconfigure.AutoConfigurationImportFilter
    at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.Java:461) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.Java:185) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.Java:321) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.Java:243) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.Java:273) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.Java:98) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.Java:678) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:520) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.Java:122) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:737) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.Java:370) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.Java:314) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.Java:152) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.Java:132) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.Java:87) ~[spring-boot-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.Java:175) ~[spring-web-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.Apache.catalina.core.StandardContext.startInternal(StandardContext.Java:5303) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:145) [catalina.jar:8.0.39]
    ... 6 common frames omitted
Caused by: Java.lang.IllegalArgumentException: Cannot instantiate factory class: org.springframework.boot.autoconfigure.AutoConfigurationImportFilter
    at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.Java:138) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.core.io.support.SpringFactoriesLoader.loadFactories(SpringFactoriesLoader.Java:91) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getAutoConfigurationImportFilters(AutoConfigurationImportSelector.Java:279) ~[spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.filter(AutoConfigurationImportSelector.Java:250) ~[spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.selectImports(AutoConfigurationImportSelector.Java:101) ~[spring-boot-autoconfigure-1.5.1.RELEASE.jar:1.5.1.RELEASE]
    at org.springframework.context.annotation.ConfigurationClassParser.processDeferredImportSelectors(ConfigurationClassParser.Java:453) ~[spring-context-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    ... 23 common frames omitted
Caused by: Java.lang.IllegalAccessException: Class org.springframework.core.io.support.SpringFactoriesLoader can not access a member of class org.springframework.boot.autoconfigure.condition.OnClassCondition with modifiers ""
    at Sun.reflect.Reflection.ensureMemberAccess(Reflection.Java:102) ~[na:1.8.0_60]
    at Java.lang.Class.newInstance(Class.Java:436) ~[na:1.8.0_60]
    at org.springframework.core.io.support.SpringFactoriesLoader.instantiateFactory(SpringFactoriesLoader.Java:135) ~[spring-core-4.2.4.RELEASE.jar:4.2.4.RELEASE]
    ... 28 common frames omitted

2017-03-01 09:26:19.053 ERROR 12568 --- [           main] org.Apache.catalina.core.ContainerBase   : A child container failed during start

Java.util.concurrent.ExecutionException: org.Apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at Java.util.concurrent.FutureTask.report(FutureTask.Java:122) ~[na:1.8.0_60]
    at Java.util.concurrent.FutureTask.get(FutureTask.Java:192) ~[na:1.8.0_60]
    at org.Apache.catalina.core.ContainerBase.startInternal(ContainerBase.Java:943) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.core.StandardEngine.startInternal(StandardEngine.Java:262) [catalina.jar:8.0.39]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:145) [catalina.jar:8.0.39]
    at org.Apache.catalina.core.StandardService.startInternal(StandardService.Java:441) [catalina.jar:8.0.39]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:145) [catalina.jar:8.0.39]
    at org.Apache.catalina.core.StandardServer.startInternal(StandardServer.Java:789) [catalina.jar:8.0.39]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:145) [catalina.jar:8.0.39]
    at org.Apache.catalina.startup.Catalina.start(Catalina.Java:629) [catalina.jar:8.0.39]
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62) ~[na:1.8.0_60]
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43) ~[na:1.8.0_60]
    at Java.lang.reflect.Method.invoke(Method.Java:497) ~[na:1.8.0_60]
    at org.Apache.catalina.startup.Bootstrap.start(Bootstrap.Java:351) [bootstrap.jar:8.0.39]
    at org.Apache.catalina.startup.Bootstrap.main(Bootstrap.Java:485) [bootstrap.jar:8.0.39]
Caused by: org.Apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:162) [catalina.jar:8.0.39]
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1408) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1398) ~[catalina.jar:8.0.39]
    at Java.util.concurrent.FutureTask.run(FutureTask.Java:266) ~[na:1.8.0_60]
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142) ~[na:1.8.0_60]
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617) ~[na:1.8.0_60]
    at Java.lang.Thread.run(Thread.Java:745) ~[na:1.8.0_60]
Caused by: org.Apache.catalina.LifecycleException: A child container failed during start
    at org.Apache.catalina.core.ContainerBase.startInternal(ContainerBase.Java:951) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.core.StandardHost.startInternal(StandardHost.Java:871) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:145) [catalina.jar:8.0.39]
    ... 6 common frames omitted

2017-03-01 09:26:19.056 ERROR 12568 --- [           main] org.Apache.catalina.startup.Catalina     : The required Server component failed to start so Tomcat is unable to start.

org.Apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:162) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.startup.Catalina.start(Catalina.Java:629) ~[catalina.jar:8.0.39]
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_60]
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62) ~[na:1.8.0_60]
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43) ~[na:1.8.0_60]
    at Java.lang.reflect.Method.invoke(Method.Java:497) ~[na:1.8.0_60]
    at org.Apache.catalina.startup.Bootstrap.start(Bootstrap.Java:351) [bootstrap.jar:8.0.39]
    at org.Apache.catalina.startup.Bootstrap.main(Bootstrap.Java:485) [bootstrap.jar:8.0.39]
Caused by: org.Apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:162) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.core.StandardServer.startInternal(StandardServer.Java:789) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:145) ~[catalina.jar:8.0.39]
    ... 7 common frames omitted
Caused by: org.Apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:162) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.core.StandardService.startInternal(StandardService.Java:441) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:145) ~[catalina.jar:8.0.39]
    ... 9 common frames omitted
Caused by: org.Apache.catalina.LifecycleException: A child container failed during start
    at org.Apache.catalina.core.ContainerBase.startInternal(ContainerBase.Java:951) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.core.StandardEngine.startInternal(StandardEngine.Java:262) ~[catalina.jar:8.0.39]
    at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:145) ~[catalina.jar:8.0.39]
    ... 11 common frames omitted

Le contenu pom.xml associé est comme ceci:

  <packaging>war</packaging>
  <artifactId>springrestdemo</artifactId>

  <version>0.0.1-SNAPSHOT</version>
  <name>springrestdemo Maven Webapp</name>
  <url>http://maven.Apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.version>6.2.0.0-SNAPSHOT</project.version>
        <springfox-swagger2.version>2.6.1</springfox-swagger2.version>
        <org.Apache.directory.api.api-all.version>1.0.0-M28</org.Apache.directory.api.api-all.version>
        <spring.framework.version>4.2.4.RELEASE</spring.framework.version>
        <spring.boot.version>1.5.1.RELEASE</spring.boot.version>
        <spring.version>4.2.4.RELEASE</spring.version>
         <start-class>hello.SpringBootWebApplicationTest</start-class>
    </properties>  

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.1.RELEASE</version>
    </parent>  

  <dependencies>

       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-web</artifactId>
           <exclusions>
                <exclusion>
                    <artifactId>log4j-over-slf4j</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
             <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-Tomcat</artifactId>
        </exclusion>
    </exclusions>
       </dependency>
       <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-test</artifactId>
           <scope>test</scope>
       </dependency>
       <dependency>
           <groupId>com.jayway.jsonpath</groupId>
           <artifactId>json-path</artifactId>
           <scope>test</scope>
       </dependency>  





    <!-- Swagger box for automatically generating doc -->
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger2</artifactId>
        <version>2.4.0</version>
    </dependency>    

    <!-- Swagger UI for Testing REST api -->    
    <dependency>
        <groupId>io.springfox</groupId>
        <artifactId>springfox-swagger-ui</artifactId>
        <version>2.4.0</version>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
    </dependency>






     <dependency>
        <groupId>org.Apache.Tomcat</groupId>
        <artifactId>Tomcat-servlet-api</artifactId>
        <version>8.0.36</version>
        <scope>provided</scope>
    </dependency>



        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
            <scope>test</scope>
        </dependency>   


  </dependencies>


    <build>
    <finalName>springrestdemo</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                <executable>true</executable>
                  <fork>true</fork>
                  <mainClass>${start-class}</mainClass>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
                <executions>
                  <execution>
                    <goals>
                      <goal>repackage</goal>
                    </goals>
                  </execution>
                </executions>        
            </plugin>

           <plugin>  
            <groupId>org.Apache.maven.plugins</groupId>  
            <artifactId>maven-compiler-plugin</artifactId>  
            <configuration>  
             <source>1.8</source>  
             <target>1.8</target>  
            </configuration>  
           </plugin>  
          </plugins>   
    </build>

    <repositories>
        <repository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>spring-releases</id>
            <url>https://repo.spring.io/libs-release</url>
        </pluginRepository>
    </pluginRepositories>

Tout le monde peut aider? Merci d'avance pour votre aide.

PS: les listes de fichiers de code sont:

Greeting.Java
GreetingController.Java
SpringBootWebApplicationTest.Java
under the same folder named "hello"

Le code de configuration est le suivant:

package hello;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;

@SpringBootApplication
public class SpringBootWebApplicationTest extends SpringBootServletInitializer {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(SpringBootWebApplicationTest.class);
    }

    public static void main(String[] args) throws Exception {
        System.out.println("Hello World! in main");
        SpringApplication.run(SpringBootWebApplicationTest.class, args);
    }

}
13
Ron

@Ron, dans votre fichier pom, vous remplacez les versions de dépendances Spring qui sont incompatibles avec la version Spring-Boot que vous utilisez, vous devez laisser Spring-Boot importer les versions de dépendances Spring prédéfinies. Vous trouverez ci-dessous la partie pertinente du pom qui doit être modifiée:

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.version>6.2.0.0-SNAPSHOT</project.version>
    <springfox-swagger2.version>2.6.1</springfox-swagger2.version>
    <org.Apache.directory.api.api-all.version>1.0.0-M28</org.Apache.directory.api.api-all.version>
<!-- REMOVE THIS <spring.framework.version>4.2.4.RELEASE</spring.framework.version> -->
    <spring.boot.version>1.5.1.RELEASE</spring.boot.version>
<!-- REMOVE THIS <spring.version>4.2.4.RELEASE</spring.version> -->
     <start-class>hello.SpringBootWebApplicationTest</start-class>
</properties> 
11
artemisian