进行防护混淆后,与现有的具有相同名称和类的不兼容bean定义发生冲突 [英] conflicts with existing, non-compatible bean definition of same name and class after proguard obfuscation

查看:682
本文介绍了进行防护混淆后,与现有的具有相同名称和类的不兼容bean定义发生冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Proguard混淆之后,出现以下错误:

after Proguard obfuscation i get the following error :

从ServletContext资源解析XML文档的意外异常 [/WEB-INF/applicationContext.xml];嵌套的异常是 java.lang.IllegalStateException:注释指定的bean名称'a' 对于Bean类[com.company.project.b.a.a.a]与现有的冲突, 具有相同名称和类的不兼容bean定义 [com.company.project.a.a]

Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.IllegalStateException: Annotation-specified bean name 'a' for bean class [com.company.project.b.a.a.a] conflicts with existing, non-compatible bean definition of same name and class [com.company.project.a.a]

我正在使用基于注释的spring配置,如何使用Proguard避免两个具有相同名称的类,因为Spring不允许两个bean具有相同的名称.

i'm using annotation based spring configuration , how can i avoid having two classes with the same name using Proguard because Spring doesn't allow two beans to have the same name.

推荐答案

我不确定这是否是您想要的,但是您可以在@Component(以及构造型@ Repository,@ Service和@Controller)中指定bean名称.值:

I'm not sure if this is what you want, but you can specify bean name in @Component (and stereotypes @Repository, @Service and @Controller) value:

@Component("myBeanName")
public class MyBean {

}

这篇关于进行防护混淆后,与现有的具有相同名称和类的不兼容bean定义发生冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆