Error message:
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-05-07 17:26:23.763 ERROR 14960 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'commonMapper' defined in file [xxx\dao\CommonMapper.class]:
Invocation of init method failed; nested exception is tk.mybatis.mapper.MapperException: tk.mybatis.mapper.MapperException: java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.TypeVariableImpl cannot be cast to java.lang.Class
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1699)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:573)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:495)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:740)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:333)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265)
at com.blog.web.WebApplication.main(WebApplication.java:20)
Reason:
@mapperscan
the scanned package cannot contain the package where the general mapper is located
Move the general mapper to other packages, then scan other Daos, @mapperscan (basepackages = "com.Blog.* *.Dao")
, and start the project without reporting an error.
Read More:
- SpringBoot Access Clickhouse Error: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘jdbcConverter’ defined in class path resource [***.class]
- Error creating bean with name ‘studentMapper‘ defined in file
- SpringBoot uses MyBatis error: Error invoking SqlProvider method (tk.mybatis.mapper.provider.base.BaseInsertProvider.dynamicSQL)
- [Solved] Springboot Error creating bean with name ‘dataSource’ defined in class path resource
- [Solved] JWT + SSO Error: Error creating bean with name ‘jwtTokenServices’
- [Solved] Error creating bean with name ‘sqlSessionFactory‘ defined in class path resource
- When integrating redis with SSM framework, error creating bean with name ‘rediscontentserviceimpl’ defined in file
- Two implementation methods of spring boot scan mapper interface class
- [Solved] ibatis.builder.BuilderException: Error parsing Mapper XML: Could not resolve type alias ‘XXX‘
- [Solved] Redis Error: Error creating bean with name stringRedisTemplate defined in class path resource
- [Solved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource‘
- [Solved] nacos Startup Error: Error creating bean with name ‘authFilterRegistration‘ defined in class path resource
- Error creating bean with name ‘redistemplate’ defined in class path resource
- [Solved] Error creating bean with name ‘braveHttpServerHandler‘ defined in class path
- Eclipse Tomcat Error creating bean with name ‘sqlSessionFactory’ defined in URL…
- [Solved] Error creating bean with name ‘enableRedisKeyspaceNotificationsInitializer‘ defined in class path
- [Solved] Error creating bean with name ‘enableRedisKeyspaceNotificationsInitializer‘ defined in class path re
- ### Error building SqlSession. ### The error may exist in com/itrs/mapper/UserMapper.xml ### Cause:
- [Solved] Notwritablepropertyexception: invalid property ‘mapperhelper’ of bean class
- [Solved] Error building SqlSession. ### The error may exist in com/itrs/mapper/OrderMapper.xml