NutzCN Logo
问答 IOC容器对象名重复,能否根据package路径做区分?
发布于 2505天前 作者 senhehe 1298 次浏览 复制 上一个帖子 下一个帖子
标签:

代码混淆以后,在不同的package里面有相同的类name,@IocBean同时放到IOC容器报错
Duplicate beanName=b, by com.dgworkshop.b.b !! Have been define by com.dgworkshop.a.a.b !!

org.nutz.lang.born.BorningException: Fail to born 'org.nutz.ioc.loader.annotation.AnnotationIocLoader'
 by args: [@(com.dgworkshop)] becasue:org.nutz.ioc.IocException: [b] # Duplicate beanName=b, by com.dgworkshop.b.b !!
 Have been define by com.dgworkshop.a.a.b !!
        at org.nutz.lang.born.DynamicConstructorBorning.born(DynamicConstructorBorning.java:21) ~[nutz-1.r.57.r3.jar:na]
        at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60) ~[nutz-1.r.57.r3.jar:na]
        at org.nutz.lang.Mirror.born(Mirror.java:990) ~[nutz-1.r.57.r3.jar:na]
        at org.nutz.ioc.loader.combo.ComboIocLoader.createIocLoader(ComboIocLoader.java:126) ~[nutz-1.r.57.r3.jar:na]
        at org.nutz.ioc.loader.combo.ComboIocLoader.<init>(ComboIocLoader.java:80) ~[nutz-1.r.57.r3.jar:na]
        at org.nutz.mvc.ioc.provider.ComboIocProvider.create(ComboIocProvider.java:20) ~[nutz-1.r.57.r3.jar:na]
        at org.nutz.mvc.impl.NutLoading.createIoc(NutLoading.java:383) ~[nutz-1.r.57.r3.jar:na]
        at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:102) ~[nutz-1.r.57.r3.jar:na]
        at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19) [nutz-1.r.57.r3.jar:na]
        at org.nutz.mvc.NutFilter._init(NutFilter.java:87) [nutz-1.r.57.r3.jar:na]
        at org.nutz.mvc.NutFilter.init(NutFilter.java:65) [nutz-1.r.57.r3.jar:na]
        at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279) [catalina.jar:7.0.76]
        at org.apache.catalina.core.ApplicationFilterConfig.getFilter(Applicatio
3 回复

好的,谢谢,再寻找其他解决方案。

可以自己指定bean的名称

添加回复
请先登陆
回到顶部