Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fundService': Injection of resource dependencies failed;


在进行SSM的Controller的编写, 从浏览器访问后端Controller的时候遇到了这个问题. 

这个问题的描述: 创建Bean的对象失败

错误代码如下: 

@Service("fundService") public class FundServiceImpl implements FundService { @Source private FundMapper fundMapper; @Override public List<Fund> selectAll() { return fundMapper.selectAll(); } }

找了很久的问题, 才发现原来是因为新的项目简称为fms, 而原来的项目简称为crm

而在数据库配置的时候, 没有修改

       <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
              <property name="basePackage" value="com.bj186.crm.mapper"></property>
              <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
       </bean>

解决办法: 将项目名修改, 把crm修改为fms

       <!--通过bean配置自动扫描并加载mapper-->
       <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
              <property name="basePackage" value="com.bj186.fms.mapper"></property>
              <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
       </bean>

问题解决!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 【解决方案】 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userHandler': Injection of resource dependencies failed; org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xtCsDao': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanC org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.facto SpringBoot 报 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bootstrapImportSelectorConfiguration': Initialization of bean failed; org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationPropertiesBeans' defined in class path resource 【报错】org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSocketHandlerMapping' defined in class path resource org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisConnectionFactory' defined in class path resource Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM