IDEA mybatis 在service无法使用@Autowired , could not autowire
2018-03-15 14:22
1156 查看
IDEA mybatis 在service无法使用@Autowired , could not autowire
1. 首先我再配置中使用的配置如下 :1 <!-- 4:配置扫描mapper层接口, 动态实现mapper层接口 , 注入spring容器 --> 2 <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> 3 <!-- 配置需要扫描的DAO的包 --> 4 <property name="basePackage" value="com.lemy.spring_mybatis.mapper" /> 5 <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/> 6 </bean>
2. 这个地方配置了 MapperScannerConfigurer 了之后就不用使用注解配置 , 直接可以使用@Autowired 就可以将mapper.java文件注入到service里面 . 但是在我的IDEA里面出现了下面的情况 :
IDEA告诉我这个不能注入 , 找不到bean , 其实这是因为IDEA里面检查的问题 3. 解决方式 因为spring检查的级别是error级别 , 我们需要改成Warning级别就可以了 .
4. 问题解决了.
相关文章推荐
- mybatis+spring boot, @Autowired 提示Could not autowire. No beans of … type found
- SpringMVC 错误分析:@Autowired Could not autowire field
- @Autowired:【Could not autowire field:】
- SpringMVC 错误分析:@Autowired Could not autowire field
- IDEA dao层“Could not autowired”(已用使用MapperScannerConfigurer扫描)
- maven + spring项目 在eclipse中没问题在idea却报错:could not autowired
- SpringMVC 错误分析:@Autowired Could not autowire field
- 使用spring的@autowired注解,无法实例化dao,service,controller等
- Spring使用Quartz定时调度Job无法Autowired注入Service的解决方案
- idea中mybatis+spring boot, mapper 提示Could not autowire. No beans of … type found解决办法
- Spring使用Quartz定时调度Job无法Autowired注入Service的解决方案
- 解决java连接SQLSERVER数据库之驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:Could not generate DH keypair
- mybatis使用bug:org.apache.ibatis.builder.IncompleteElementException: Could not find parameter map java
- spring注解方式 idea报could not autowire,eclipse却没有问题
- 抛出异常:驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:Could not generate DH keypair”。
- 解决java连接SQLSERVER数据库之驱动程序无法通过使用安全套接字层(SSL)加密与 SQL Server 建立安全连接。错误:Could not generate DH keypair”。
- new 出的对象无法使用 @Autowired装配进来的属性,会报null
- IDEA在编辑时提示could not autowire
- ORA-12154: TNS:could not resolve service name无法解析指定的连接标志符
- 关于在java6中使用XFire时碰到的一个问题Could not initialize Service