Today, I made an error when integrating mybatis with spring, as follows:
Caused by: org.springframework.beans . factory.BeanCreationException :
Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [config/ applicationContext.xml ]:
Cannot resolve reference to bean ‘config/ mybatis.xml ‘ while setting bean property ‘configLocation’;
nested exception is org.springframework.beans . factory.NoSuchBeanDefinitionException : No bean named ‘config/ mybatis.xml ‘ is defined
My English is not very good. I understand it in general applicationContext.xml There is an error registering configlocation in
<bean id=”sqlSessionFactory” class=” org.mybatis.spring .SqlSessionFactoryBean”>
<property name=”dataSource” ref=”dataSource”></property>
<property name=”configLocation” ref=”config/ mybatis.xml “></property>
</bean>
After a careful examination of the code, I found that there was something wrong. Alas, the correct code is as follows
<bean id=”sqlSessionFactory” class=” org.mybatis.spring .SqlSessionFactoryBean”>
<property name=”dataSource” ref=”dataSource”></property>
<property name=”configLocation” value=”config/ mybatis.xml “></property>
</bean>
Give me a fulcrum, I can pry the whole earth, give me a mistake, I can support the whole project
Read More:
- Error creating bean with name ‘sqlsessionfactory’ defined in class path resource…..
- Error creating bean with name ‘datasource’ defined in class path resource
- Error creating bean with name ‘requestMappingHandlerAdapter‘ defined in class path resource
- Error creating bean with name ‘lettuceClientResources‘ defined in class path resource
- Error creating bean with name ‘feignTargeter‘ defined in class path resource [org/springframework/cl
- Error creating bean with name ‘redisTemplate‘ defined in class path resource [xx/RedisConfig.class]
- Error creating bean with name ‘sqlsessionfactory’ defined in ServletContext resource)
- Error creating bean with name ‘entitymanagerfactory’ defined in class path resource
- Error creating bean with name ‘configurationPropertiesBeans‘ defined in class path resource
- Solution to the problem of spring boot running test class error creating bean with name ‘serverendpoint exporter’ defined
- Error creating bean with name ‘sqlsessionfactory’ appears in SSM framework integration‘
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
- org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘use
- An error happened during template parsing (template: “class path resource
- Error creating bean with name usercontroller appears when springboot starts
- Error creating bean with name ‘application‘: Instantiation of bean failed;
- Error creating bean with name ‘xxcontroller’
- Error: java.lang.IllegalArgumentExcept :Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required
- [Fixed]No bean named ‘sqlSessionFactoryBean’ available
- Idea SpringBoot:Error creating bean with name ‘XXXXController‘