ProGuard混淆导致Spring Bean名称冲突的问题咨询与解决求助
启动错误
2020-11-06 18:07:31.452 WARN 13120 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.maple.MapleApplication]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'a' for bean class [com.maple.a.d.a.a] conflicts with existing, non-compatible bean definition of same name and class [com.maple.a.b.a] 2020-11-06 18:07:31.463 ERROR 13120 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.maple.MapleApplication]; nested exception is org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'a' for bean class [com.maple.a.d.a.a] conflicts with existing, non-compatible bean definition of same name and class [com.maple.a.b.a]
问题说明与已尝试方向
- 已尝试适配Spring的Bean命名逻辑,采用
definition.getBeanClassName()规则生成Bean名称,该方案未生效 - 若通过注解手动为每个Bean自定义名称规避冲突,操作繁琐、维护成本高
- 咨询ProGuard是否支持类名去重的相关配置,目前暂未找到对应配置方法
内容的提问来源于stack exchange,提问作者XiaoyuZhang
相关产品推荐
相关产品推荐

