分享

non

 instl 2018-07-18

错误代码:
2009-33-18 13:33:33, 388 [org.springframework.web.context.ContextLoader] [ERROR]
Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected excep
tion parsing XML document from file [F:\java6\idear2010\idear2010\WEB-INF\classe
s\applicationContext.xml]; nested exception is java.lang.IllegalStateException:
Annotation-specified bean name 'homeAction' for bean class [com.idearsoft.idear.
module.SystemMaintain.action.HomeAction] conflicts with existing, non-compatible
bean definition of same name and class [com.idearsoft.idear.module.Main.action.
HomeAction]

 

在整合struts2.1.6+spring2.5.6开发中,使用了注解和struts-convention来实现零配置管理。spring也使用注解annotation方式。现在的问题是:我在连个个不同package中有两个相同名称的类,只是类所在的目录不同。例如在 com.idearsoft.idear.module.SystemMaintain.action下有个HomeAction.java,在 com.idearsoft.idear.module.Main.action也有一个HomeAction.java。在应用服务器启动时总是提示这两个homeAction 冲突。

 

 

回答:

spring管理bean大概类似把bean实例化放到map中,它会以配置的id和name(如果配置的话)
为key存放起来,2个一样的肯定要成冲突楼主应该给他们换个名字就成啦
controller("systemHomeAction")
controller("moduleHomeAction")

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多