尝试运行spring boot app时没有这样的方法错误

时间:2017-08-17 09:10:24

标签: java spring-boot

我有一个春季启动应用程序  这是我得到的错误:

java.lang.NoSuchMethodError: org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider: method <init>()V not found
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.<init>(ClassPathBeanDefinitionScanner.java:158)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.<init>(ClassPathBeanDefinitionScanner.java:138)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.<init>(ClassPathBeanDefinitionScanner.java:111)
at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.<init>(ClassPathBeanDefinitionScanner.java:83)
at org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext.<init>(AnnotationConfigEmbeddedWebApplicationContext.java:67)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at org.springframework.beans.BeanUtils.instantiate(BeanUtils.java:77)
at org.springframework.boot.SpringApplication.createApplicationContext(SpringApplication.java:529)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:299)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
at com.ceb.tc.TcCacheApplication.main(TcCacheApplication.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
2017-08-17 07:49:35,202 [background-preinit] INFO  org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.3.5.Final

我尝试将spring boot app版本更改为1.5.1到1.5.6,但没有用。我现在被困住了。所以需要帮助

这是我的pom.xml

    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.0.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.7</java.version>
</properties>

<repositories>
    <repository>
        <id>admin-repository</id>
        <name>adminRepo</name>
        <url>file:${project.build.directory}\..\..\admin\mvnrepository</url>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>ignore</checksumPolicy>
        </releases>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>ignore</checksumPolicy>
        </snapshots>
    </repository>
</repositories>


<dependencies>


    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>hibernate-core</artifactId>
                <groupId>org.hibernate</groupId>
            </exclusion>
            <exclusion>
                <artifactId>hibernate-entitymanager</artifactId>
                <groupId>org.hibernate</groupId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-jpa</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <artifactId>hibernate-validator</artifactId>
                <groupId>org.hibernate</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j</artifactId>
        <version>1.3.8.RELEASE</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/net.sourceforge.jtds/jtds -->
    <dependency>
        <groupId>net.sourceforge.jtds</groupId>
        <artifactId>jtds</artifactId>
        <version>1.3.1</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.6</version>
    </dependency>


    <dependency>
        <groupId>org.apache.solr</groupId>
        <artifactId>solr-solrj</artifactId>
        <version>3.6.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.3.1</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.3</version>
    </dependency>
    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpmime</artifactId>
        <version>4.3.1</version>
    </dependency>


    <dependency>
        <groupId>net.sf.flexjson</groupId>
        <artifactId>flexjson</artifactId>
        <version>2.1</version>
    </dependency>


    <dependency>
        <groupId>axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>javax.xml</groupId>
        <artifactId>jaxrpc-api</artifactId>
        <version>1.1</version>
    </dependency>

    <dependency>
        <groupId>jdom</groupId>
        <artifactId>jdom</artifactId>
        <version>b7</version>
    </dependency>

    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4.5</version>
    </dependency>

    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.2.2.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.2.2.Final</version>
        <exclusions>
            <exclusion>
                <groupId>cglib</groupId>
                <artifactId>cglib</artifactId>
            </exclusion>
            <exclusion>
                <groupId>dom4j</groupId>
                <artifactId>dom4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>3.2.5.RELEASE</version>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <artifactId>commons-logging</artifactId>
                <groupId>commons-logging</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>3.2.5.RELEASE</version>
        <scope>compile</scope>
        <exclusions>
            <exclusion>
                <artifactId>commons-logging</artifactId>
                <groupId>commons-logging</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <!--  --><version>5.3.5.Final</version>
    </dependency>

    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>
    </dependencies>

这是运行应用程序的类

import java.util.TimeZone;

import javax.annotation.PostConstruct;

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

@SpringBootApplication
public class TcCacheApplication {

    @PostConstruct
    void started() {
        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
    }

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

更新

我已更正了我的pom.xml以适应建议的更改,但log4j版本除了大部分已删除。我无法删除log4j的版本,因为它在命令“mvn clean install”时出现错误,需要版本号

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>hibernate-core</artifactId>
                    <groupId>org.hibernate</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>hibernate-entitymanager</artifactId>
                    <groupId>org.hibernate</groupId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.data</groupId>
                    <artifactId>spring-data-jpa</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>hibernate-validator</artifactId>
                    <groupId>org.hibernate</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j</artifactId>
             <version>1.3.8.RELEASE</version> 
        </dependency>

        <!-- https://mvnrepository.com/artifact/net.sourceforge.jtds/jtds -->
        <dependency>
            <groupId>net.sourceforge.jtds</groupId>
            <artifactId>jtds</artifactId>
            <version>1.3.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.6</version>
        </dependency>


        <dependency>
            <groupId>org.apache.solr</groupId>
            <artifactId>solr-solrj</artifactId>
            <version>3.6.1</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            </dependency>


        <dependency>
            <groupId>net.sf.flexjson</groupId>
            <artifactId>flexjson</artifactId>
            <version>2.1</version>
        </dependency>


        <dependency>
            <groupId>axis</groupId>
            <artifactId>axis</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>javax.xml</groupId>
            <artifactId>jaxrpc-api</artifactId>
            <version>1.1</version>
        </dependency>

        <dependency>
            <groupId>jdom</groupId>
            <artifactId>jdom</artifactId>
            <version>b7</version>
        </dependency>

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.5</version>
        </dependency>

        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>cglib</groupId>
                    <artifactId>cglib</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>dom4j</groupId>
                    <artifactId>dom4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>

            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            </dependency>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
</dependency>   

+- com.gartner.ceb:admin:jar:12.0.0:compile
+- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.5.RELEASE:compile
|  +- org.springframework.boot:spring-boot-starter:jar:1.5.5.RELEASE:compile
|  |  \- org.yaml:snakeyaml:jar:1.17:runtime

|  +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.5.RELEASE:compile
|  |  \- org.aspectj:aspectjweaver:jar:1.8.10:compile
|  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.5.RELEASE:compile
|  |  +- org.apache.tomcat:tomcat-jdbc:jar:8.5.16:compile
|  |  |  \- org.apache.tomcat:tomcat-juli:jar:8.5.16:compile
|  |  \- org.springframework:spring-jdbc:jar:4.3.10.RELEASE:compile
|  +- javax.transaction:javax.transaction-api:jar:1.2:compile
|  \- org.springframework:spring-aspects:jar:4.3.10.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-data-redis:jar:1.5.5.RELEASE:compil
|  +- org.springframework.data:spring-data-redis:jar:1.8.5.RELEASE:compile
|  |  +- org.springframework.data:spring-data-keyvalue:jar:1.2.5.RELEASE:compile
|  |  +- org.springframework:spring-oxm:jar:4.3.10.RELEASE:compile
|  |  \- org.springframework:spring-context-support:jar:4.3.10.RELEASE:compile
|  \- redis.clients:jedis:jar:2.9.0:compile
|     \- org.apache.commons:commons-pool2:jar:2.4.2:compile
+- org.springframework.boot:spring-boot-starter-web:jar:1.5.5.RELEASE:compile
|  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.5.RELEASE:compile
|  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.16:compile
|  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.16:compile
|  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.16:compile
|  +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.9:compile
|  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
|  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.9:compile
|  +- org.springframework:spring-web:jar:4.3.10.RELEASE:compile
|  \- org.springframework:spring-webmvc:jar:4.3.10.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-test:jar:1.5.5.RELEASE:test
|  +- org.springframework.boot:spring-boot-test:jar:1.5.5.RELEASE:test
|  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.5.RELEASE:tes
|  +- com.jayway.jsonpath:json-path:jar:2.2.0:test
|  |  \- net.minidev:json-smart:jar:2.2.1:test
|  |     \- net.minidev:accessors-smart:jar:1.1:test
|  |        \- org.ow2.asm:asm:jar:5.0.3:test
|  +- junit:junit:jar:4.12:test
|  +- org.assertj:assertj-core:jar:2.6.0:test
|  +- org.mockito:mockito-core:jar:1.10.19:test
|  |  \- org.objenesis:objenesis:jar:2.1:test
|  +- org.hamcrest:hamcrest-core:jar:1.3:test
|  +- org.hamcrest:hamcrest-library:jar:1.3:test
|  +- org.skyscreamer:jsonassert:jar:1.4.0:test
|  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
|  +- org.springframework:spring-core:jar:4.3.10.RELEASE:compile
|  \- org.springframework:spring-test:jar:4.3.10.RELEASE:test
+- org.springframework.boot:spring-boot-devtools:jar:1.5.5.RELEASE:compile
|  +- org.springframework.boot:spring-boot:jar:1.5.5.RELEASE:compile
|  \- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.5.RELEASE:compile
+- org.springframework.boot:spring-boot-starter-log4j:jar:1.3.8.RELEASE:compile
|  +- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
|  +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile
|  +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile
|  \- log4j:log4j:jar:1.2.17:compile
+- net.sourceforge.jtds:jtds:jar:1.3.1:compile
+- commons-lang:commons-lang:jar:2.6:compile
+- org.apache.commons:commons-lang3:jar:3.1:compile
+- org.apache.poi:poi:jar:3.6:compile
|  \- commons-logging:commons-logging:jar:1.1:compile
|     +- logkit:logkit:jar:1.0.1:compile
|     +- avalon-framework:avalon-framework:jar:4.1.3:compile
|     \- javax.servlet:servlet-api:jar:2.3:compile
+- org.apache.solr:solr-solrj:jar:3.6.1:compile
|  +- commons-httpclient:commons-httpclient:jar:3.1:compile
|  +- commons-io:commons-io:jar:2.1:compile
|  +- org.codehaus.woodstox:wstx-asl:jar:3.2.7:runtime
|  \- org.slf4j:slf4j-api:jar:1.7.25:compile
+- org.apache.httpcomponents:httpclient:jar:4.5.3:compile
|  \- commons-codec:commons-codec:jar:1.10:compile
+- org.apache.httpcomponents:httpcore:jar:4.4.6:compile
+- org.apache.httpcomponents:httpmime:jar:4.5.3:compile
+- net.sf.flexjson:flexjson:jar:2.1:compile
+- axis:axis:jar:1.2:compile
+- javax.xml:jaxrpc-api:jar:1.1:compile
+- jdom:jdom:jar:b7:compile
+- javax.mail:mail:jar:1.4.5:compile
+- javax.activation:activation:jar:1.1.1:compile
+- org.hibernate:hibernate-core:jar:5.0.12.Final:compile
|  +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile
|  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
|  +- org.javassist:javassist:jar:3.21.0-GA:compile
|  +- antlr:antlr:jar:2.7.7:compile
|  +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
|  +- org.jboss:jandex:jar:2.0.0.Final:compile
|  +- dom4j:dom4j:jar:1.6.1:compile
|  \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
+- org.hibernate:hibernate-entitymanager:jar:5.0.12.Final:compile
+- org.springframework.security:spring-security-core:jar:4.2.3.RELEASE:compile
|  +- aopalliance:aopalliance:jar:1.0:compile
|  +- org.springframework:spring-aop:jar:4.3.10.RELEASE:compile
|  +- org.springframework:spring-beans:jar:4.3.10.RELEASE:compile
|  \- org.springframework:spring-expression:jar:4.3.10.RELEASE:compile
+- org.springframework.security:spring-security-config:jar:4.2.3.RELEASE:compile
+- org.springframework.data:spring-data-jpa:jar:1.11.5.RELEASE:compile
|  +- org.springframework.data:spring-data-commons:jar:1.13.5.RELEASE:compile
|  +- org.springframework:spring-orm:jar:4.3.10.RELEASE:compile
|  +- org.springframework:spring-tx:jar:4.3.10.RELEASE:compile
|  \- org.aspectj:aspectjrt:jar:1.8.10:compile
+- org.hibernate:hibernate-validator:jar:5.3.5.Final:compile
|  \- com.fasterxml:classmate:jar:1.3.3:compile
+- javax.validation:validation-api:jar:1.1.0.Final:compile
\- org.springframework:spring-context:jar:4.3.10.RELEASE:compile
------------------------------------------------------------------------
BUILD SUCCESS

3 个答案:

答案 0 :(得分:1)

基本上你的依赖是一团糟。

  1. 您正在混合使用Spring Boot 1.5.0和1.3.8版本的jar,永远不要混合使用框架版本
  2. 您将包含一个旧版本的Spring Security,其中包含一个旧的,不受支持的Spring版本
  3. 如果您想使用特定版本的Hibernate,请指定版本,不要自己包含它们。
  4. 你的依赖关系应该是这样的。

    <dependencies>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
        <exclusions>
          <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
          </exclusion>      
        </exclusions>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-redis</artifactId>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-mail</artifactId>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-validation</artifactId>
      </dependency>
        <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <optional>true</optional>
      </dependency>
      <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-log4j</artifactId>
      </dependency>
      <!-- https://mvnrepository.com/artifact/net.sourceforge.jtds/jtds -->
      <dependency>
        <groupId>net.sourceforge.jtds</groupId>
        <artifactId>jtds</artifactId>
        <version>1.3.1</version>
      </dependency>
      <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
      <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
      </dependency>
      <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
      </dependency>
      <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.6</version>
      </dependency>
      <dependency>
        <groupId>org.apache.solr</groupId>
        <artifactId>solr-solrj</artifactId>
        <version>3.6.1</version>
      </dependency>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.3.1</version>
      </dependency>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.3</version>
      </dependency>
      <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpmime</artifactId>
        <version>4.3.1</version>
      </dependency>
      <dependency>
        <groupId>net.sf.flexjson</groupId>
        <artifactId>flexjson</artifactId>
        <version>2.1</version>
      </dependency>
      <dependency>
        <groupId>axis</groupId>
        <artifactId>axis</artifactId>
        <version>1.2</version>
      </dependency>
      <dependency>
        <groupId>javax.xml</groupId>
        <artifactId>jaxrpc-api</artifactId>
        <version>1.1</version>
      </dependency>
      <dependency>
        <groupId>jdom</groupId>
        <artifactId>jdom</artifactId>
        <version>b7</version>
      </dependency>
    </dependencies>
    

    请注意添加spring-boot-starter-securityspring-boot-starter-validationspring-boot-starter-mail以获得正确的依赖关系。

    要固定hibernate版本,请添加此

    <properties>
     <hibernate.version>4.2.2.Final</hibernate.version>
    </properties>
    

答案 1 :(得分:0)

错误:

ClassPathScanningCandidateComponentProvider: method <init>()V not found

指的是找不到类ClassPathScanningCandidateComponentProvider的no-args构造函数。

此构造函数自Spring的4.3.6版本开始存在 https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.html#ClassPathScanningCandidateComponentProvider--

protected ClassPathScanningCandidateComponentProvider()
Protected constructor for flexible subclass initialization.
Since:
4.3.6

确保您的spring-context运行版本至少为4.3.6

编辑:您可以尝试在项目上运行以下内容,以确定哪些版本的依赖项maven正在解析。

mvn dependency:tree

答案 2 :(得分:0)

您正在手动设置Spring Framework的版本以及其他依赖项。你不应该这样做。

https://spring.io/blog/2016/04/13/overriding-dependency-versions-with-spring-boot

        <artifactId>spring-security-core</artifactId>
        <version>3.2.5.RELEASE</version>

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j</artifactId>
    <version>1.3.8.RELEASE</version>
    </dependency>

此外,您定义的许多其他依赖项应该从Spring Boot Starters中传递,否则您可能会遇到相同的运行时问题,这些问题存在不兼容的依赖项版本。