【SSM】报错及解决

版权声明: https://blog.csdn.net/qq_35315154/article/details/85247023
  • spring mvc mybatis 整合错误1

(放置事务注解的位置错误)(表现:直接访问.jsp,.html报错,写一个测试类,测试mapper,报错)
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionDecorator for element [annotation-driven]

  • 整合错误2(dataSource拼写错误)

Offending resource: class path resource [applicationContext.xml]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in class path resource [applicationContext.xml]: Cannot resolve reference to bean 'dataSouorce' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dataSouorce' is defined

  • 整合错误3(springmvc.xml 注解驱动配置错误 修改后未解决,仍然报一下错误。注解@Service 和@Controller,仍然报错。最后直接项目删了,重新copy配置文件,问题解决了。等于说是又建了一个,autowired dependencies failed还是没有解决)    

Error creating bean with name 'itemsController': Injection of autowired dependencies failed; 
//错误的创建名为‘xxx’(原因):自动接入依赖的注入失败
nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.t.service.ItemService com.t.controller.ItemsController.itemService;
//嵌套的异常是xx.BeanCreationException(原因):不能够自动接入域:private com.t.service.ItemService ,com.t.controller.ItemsController.itemService;

 nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.t.service.ItemService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
 /*
qualifying
adj.    使具有资格的;
v.    (使) 具有资格( qualify的现在分词 ); 有权; 达标; 使所说的话语气减弱(或更具体等);
 */

 //嵌套的异常是xx..NoSuchBeanDefinitionException:没有具有资格的类型为xx的bean 被找到 为依赖:额外的在至少一个 有资格作为自动接入显而易见的bean。
 依赖注解: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

猜你喜欢

转载自blog.csdn.net/qq_35315154/article/details/85247023