Spring无法实例化接口org.springframework.boot.SpringApplicationRunListene

时间:2018-02-24 18:05:12

标签: spring

我的项目有一个奇怪的问题,因为它适用于Linux,但相同的配置和代码在Windows平台上不起作用; /

在Windows上尝试使用Spring套件工具构建它时出错:

  

线程“main”中的异常java.lang.IllegalArgumentException:无法实例化接口org.springframework.boot.SpringApplicationRunListener:org.springframework.boot.context.event.EventPublishingRunListener       在org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:413)       在org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:392)       在org.springframework.boot.SpringApplication.getRunListeners(SpringApplication.java:378)       在org.springframework.boot.SpringApplication.run(SpringApplication.java:291)       在org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)       在org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)       在com.example.resty.RestyApplication.main(RestyApplication.java:10)   引起:org.springframework.beans.BeanInstantiationException:无法实例化[org.springframework.boot.context.event.EventPublishingRunListener]:构造函数抛出异常;嵌套异常是java.lang.NoClassDefFoundError:org / springframework / aop / framework / AopProxyUtils       在org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)       在org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:409)       ......还有6个   引起:java.lang.NoClassDefFoundError:org / springframework / aop / framework / AopProxyUtils       在org.springframework.context.event.AbstractApplicationEventMulticaster.addApplicationListener(AbstractApplicationEventMulticaster.java:105)       在org.springframework.boot.context.event.EventPublishingRunListener。(EventPublishingRunListener.java:56)       at java.base / jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)       at java.base / jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)       at java.base / jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)       at java.base / java.lang.reflect.Constructor.newInstance(Unknown Source)       在org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)       ......还有7个   引起:java.lang.ClassNotFoundException:org.springframework.aop.framework.AopProxyUtils       at java.base / jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)       at java.base / jdk.internal.loader.ClassLoaders $ AppClassLoader.loadClass(Unknown Source)       at java.base / java.lang.ClassLoader.loadClass(Unknown Source)       ......还有14个

我的pom.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example.test</groupId>
<artifactId>Demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Resty</name>
<description>Demo project for Spring Boot</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.10.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.8</java.version>
</properties>

<dependencies>


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


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

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

0 个答案:

没有答案