在整合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")

在注解后面换上个名字eg:@service("roleService")

配置实例的时候名字不能一样

non-compatible bean definition of same name and class的更多相关文章

  1. 【spring】non-compatible bean definition of same name and class

    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected excep tion parsing XML do ...

  2. [转载]Spring Bean Definition Inheritance

    Following is the configuration file Beans.xml where we defined "helloWorld" bean which has ...

  3. SpringMVC conflicts with existing, non-compatible bean definition of same name and class 的解决办法

    问题起因 最近,项目组的里的同事遇到一个问题,他自己负责的模块,SpringMVC的Controller与其他模块的Controller 类名重名了,导致整个工程都起不来了. 后台报的错误是这样的: ...

  4. Spring错误——Spring 注解——factory-bean reference points back to the same bean definition

    背景:学习Spring,在使用注解@Bean的name属性配置<bean>实例时,不能注册实例成功 报错 WARNING: Exception encountered during con ...

  5. org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unexpected failure during bean definition parsing Offending resource: class path resource [applicationC

    这个错误是 org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration proble ...

  6. Spring - Bean Definition Bean定义 给容易提供元数据的3方法

    Spring Bean Definition https://www.tutorialspoint.com/spring/spring_bean_definition.htm The objects ...

  7. Bean Definition从加载、解析、处理、注册到BeanFactory的过程。

    为了弄清楚Bean是怎么来的,花费了大把功夫,现在要把Bean Definition的加载.解析.处理.注册到bean工厂的过程记下来.这只是bean definition 的加载.解析.处理.注册过 ...

  8. No bean class specified on bean definition 解决方案

    调试Spring项目出现No bean class specified on bean definition异常 但是控制台并没有给出其他相关信息了 这个时候可以在AbstractBeanDefini ...

  9. spring 'arroudAspect' for bean class [com.dw.test.ArroudAspect] conflicts with existing, non-compatible bean definition of same name and class [com.dw.aspect.ArroudAspect]

    Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: ...

  10. 曹工说Spring Boot源码系列开讲了(1)-- Bean Definition到底是什么,附spring思维导图分享

    写在前面的话&&About me 网上写spring的文章多如牛毛,为什么还要写呢,因为,很简单,那是人家写的:网上都鼓励你不要造轮子,为什么你还要造呢,因为,那不是你造的. 我不是要 ...

随机推荐

  1. jQuery鼠标悬停文字渐隐渐现动画效果

    jQuery鼠标悬停文字渐隐渐现动画效果 当时是做项目的时候用到的所以图片有些大,九张,真正要做图片不需要这么大 css样式 <style> *{ margin: 0; padding: ...

  2. 简单unix 局域网的TCP会话

    client.c #include <stdio.h> #include <stdlib.h> #include <string.h> #include <e ...

  3. 如果想从jenkins直接生成docker镜像,并推送到harbor中,最简单的脚本如何实现?

    如果不考虑意外, 第一版最简单的构思如下: #!/usr/bin/env python # -*- coding: utf-8 -*- import getopt, sys import subpro ...

  4. centos7当中的systemd及systemctl(节选)

    全面进入centos7时代,这个东东是需要系统了解的. http://blog.jobbole.com/85070/?utm_source=blog.jobbole.com&utm_mediu ...

  5. Linux下安装Sybase ASE 16

    https://jingyan.baidu.com/article/414eccf67281a16b421f0a76.html

  6. yii2 项目初始化

    yii 项目目录下执行.composer self-updatecomposer global require "fxp/composer-asset-plugin:^1.4.1" ...

  7. 浙江省第十二届省赛 B - Team Formation

    Description For an upcoming programming contest, Edward, the headmaster of Marjar University, is for ...

  8. CentOS中文乱码解决办法

    打开文件:/etc/sysconfig/i18n ,对其中相关属性配置修改成如下: LANG="zh_CN.GB18030" LANGUAGE="zh_CN.GB1803 ...

  9. ubuntu 修改权限

    在linux终端先输入ll,可以看到如: -rwx-r–r– (一共10个参数) 表示文件所属组和用户的对应权限. 第一个跟参数属于管理员,跟chmod无关,先不管. 2-4参数:属于user 5-7 ...

  10. Android开机过程

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha Android开机过程 BootLoder引导,然后加载Linux内核. 0号进程ini ...