gpt4 book ai didi

spring - 与相同名称和类的现有不兼容 bean 定义冲突

转载 作者:行者123 更新时间:2023-12-02 22:43:48 25 4
gpt4 key购买 nike

在我混淆了我的项目之后我得到了这个错误,eventghout 只有我的实现类 com.company.project.f.a.a.b 被限定为 @Component("myImpl")

java.lang.IllegalStateException: Annotation-specified bean name 'myImpl' for bean class [com.company.project.f.a.a.b] conflicts with existing, non-compatible bean definition of same name and class [com.company.project.f.a.a.a]

我真的不明白为什么 spring 为接口(interface)和实现赋予相同的名称。我的 Proguard 配置有问题吗?

最佳答案

您可以尝试保留 @Component类(class) as is通过 -keep 告诉混淆器这样做选项。

如果您使用 proguarg maven 插件,您可以将此选项设置为:

<plugin>
... ...
<artifactId>proguard-maven-plugin</artifactId>
... ...
<configuration>
<obfuscate>true</obfuscate>
<options>
... ...
<option>-keep @org.springframework.stereotype.Component class *</option>
... ...
</options>
... ...
</configuration>
</plugin>

它将保留 @Component组件逆向工程和 Spring 友好 :)

关于spring - 与相同名称和类的现有不兼容 bean 定义冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10338377/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com