spring扫描出现Annotation-specified bean name 'userService' for bean class [com.test.service.UserService]
2017-07-13 19:53
921 查看
spring中配置 <context:component-scan base-package="com." />对服务自动扫描
public interface PersonService {}
@Service("personService")
public class PersonServiceImpl implements PersonService {}
启动报错,
Annotation-specified bean name 'personService' for bean class [com.test.service.PersonService] conflicts with existing
提示personservice重名,改为@Service后启动正常。
或者改spring中配置 <context:component-scan base-package="com...impl.*" /> 也能解决问题。
是不是spring对每个扫描过的文件都创建个bean名称呢
public interface PersonService {}
@Service("personService")
public class PersonServiceImpl implements PersonService {}
启动报错,
Annotation-specified bean name 'personService' for bean class [com.test.service.PersonService] conflicts with existing
提示personservice重名,改为@Service后启动正常。
或者改spring中配置 <context:component-scan base-package="com...impl.*" /> 也能解决问题。
是不是spring对每个扫描过的文件都创建个bean名称呢
相关文章推荐
- Annotation-specified bean name 'personDubboConsumerService' for bean class [cn.com.hellowood.dubboc
- Annotation-specified bean name 'drugInfoService' for bean class conflicts with existing
- FAQ(29):Cannot find class [com.smbms.pojo.UserServiceImpl] for bean with name 'userService' defined
- 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]
- Spring异常:Annotation-specified bean name.. for bean class ...
- FAQ(28):CannotLoadBeanClassException: Cannot find class [com.smbms.pojo.UserServiceImpl] for bean wi
- org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.oskyhang.gbd.service.UserService] found for dependency: expected at least 1 bean which qualifies as aut
- spring+springmvc+myibatic中出现了Error creating bean with name 'userService':
- Error creating bean with name 'userService' defined in class path resource [beans.xml]: Unsatisfied dependency expressed through
- FAQ(32):There is no getter for property named 'userrName' in 'class com.smbms.pojo.User'
- No matching bean of type [com.spw.service.UserService] found for dependency
- "The value for the useBean class attribute com.Bean.UserInfo is invalid."解决方案
- Could not instantiate bean class [com.bjsxt.service.UserService]: No default constructor found;
- git push时出现Username for 'https://github.com': 解决方法
- Spring AOP 开发中遇到问题:Caused by: java.lang.IllegalArgumentException: warning no match for this type name: com.xxx.collector.service.impl.XxxServiceImpl [Xlint:invalidAbsoluteTypeName]
- Error creating bean with name 'userService': Injection of resource methods failed; nested exception is org.springframework.beans
- SSH搭建时的错误之(1) Error creating bean with name 'testService' defined in class path resource
- 'customerService' for bean class [com.cd.service.business.customer.impl.CustomerService]
- Error creating bean with name 'userService': Injection of resource methods failed; nested exception is org.springframework.beans
- git push时出现 Username for 'https://github.com':