java 名称为“org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory”的 bean 上的销毁方法引发异常

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46780383/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 09:21:08  来源:igfitidea点击:

Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception

javaspringmavenspring-bootspring-data-jpa

提问by Gene Xu

I've been trying to solve this "destory method exception" with online tips but have no success. Here is the error message:

我一直在尝试通过在线提示解决这个“销毁方法异常”,但没有成功。这是错误消息:

2017-10-16 15:58:13.234 ERROR 12276 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception

2017-10-16 15:58:13.234 错误 12276 --- [main] osbfsDefaultListableBeanFactory:销毁名为“org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory”的 bean 的方法引发异常

And here is my POM.xml dependencies:

这是我的 POM.xml 依赖项:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-aws</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-aws-jdbc</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.16.6</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
</dependencies>

From online it seems the problem is at the spring-boot-starter-data-jpa dependency. I tried older versions of the depenency, and clean mvn but none of them works.

从网上看来,问题出在 spring-boot-starter-data-jpa 依赖项上。我尝试了旧版本的依赖,并清理了 mvn,但它们都不起作用。

Update

更新

After regenerate pom from spring initializr, I still got the same error. Here is my pom.xml dependencies:

从spring initializr重新生成pom后,我仍然遇到同样的错误。这是我的 pom.xml 依赖项:

    <dependencies>
<!--need this aws dependency for some packages-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-aws</artifactId>
        </dependency>
<!--need this aws dependency for some packages-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-aws-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.6</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
    </dependencies>

Any suggestions?

有什么建议?

采纳答案by surya

There are so many duplicate jars here ..

这里有很多重复的罐子..

I would go hereto generate a spring project with required dependencies.

我会去这里生成一个具有所需依赖项的 spring 项目。

回答by Jacob

i had same issue with exception

我有同样的问题,但有例外

:Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized

and the error was in my declaration syntax of spring profile

错误出在我的 spring 配置文件声明语法中

@Profile({"production, dev"})

the correct way :

正确的方法:

@Profile({"production","dev"})