这次踩坑遇到的报错提示如下:
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 2019-03-29 02:50:33.840 ERROR 5298 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'PYEveryMomentController': Unsatisfied dependency expressed through field 'everyMomentService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'PYEveryMomentServiceImpl': Unsatisfied dependency expressed through field 'everyMomentMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'PYEveryMomentMapper' defined in file [/Users/yons/Documents/IHome/target/classes/com/zhujizheng/IHome/generator/mapper/PYEveryMomentMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [/Users/yons/Documents/IHome/target/classes/mapper/PYEveryMomentThumbupMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.LONG
一开始的时候我是直接复制百度搜索,结果查到了各种不同的问题AND不同的解决办法,弄了将近一个小时,最后我发现其实网上的报错提示前面的都差不多,均是
To display the auto-configuration report re-run your application with 'debug' enabled.
或者
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name
当然我也是用这个去查的
不过既然前面的提示都一样,那关键应该是最后不一样的部分,所以我搜索了最后面的提示
Cause: java.lang.IllegalArgumentException: No enum constant org.apache.ibatis.type.JdbcType.LONG
找到了这篇文章
看到这个,如果你碰到一样的问题跟我一样的话,相信你现在已经能想起来问题出在哪里了
是的,就是因为字段的类型写错了,我是把BIGINT类型写成了LONG
记录一下,以免下次又折腾一小时