报错信息:
Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tbPersonServiceImpl': Unsatisfied dependency expressed through field 'baseMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'tbPersonMapper' defined in file [D:\IDEA\MQ\springcloud_parent\springcloud_login_service\target\classes\com\dk\mapper\TbPersonMapper.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 [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.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.beans.factory.BeanCreationException: Error creating bean with name 'identifierGenerator' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/IdentifierGeneratorAutoConfiguration$InetUtilsAutoConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator]: Factory method 'identifierGenerator' threw exception; nested exception is java.lang.NoSuchMethodError: com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator.<init>(Ljava/net/InetAddress;)V
2022-03-07 18:27:23.103 INFO 2752 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-0} closing ...
2022-03-07 18:27:23.105 INFO 2752 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-03-07 18:27:23.114 WARN 2752 --- [ main] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [RxIoScheduler-1 (Evictor)] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
java.lang.Thread.run(Unknown Source)
2022-03-07 18:27:23.129 INFO 2752 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-03-07 18:27:23.135 ERROR 2752 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
com.baomidou.mybatisplus.autoconfigure.IdentifierGeneratorAutoConfiguration$InetUtilsAutoConfig.identifierGenerator(IdentifierGeneratorAutoConfiguration.java:57)
The following method did not exist:
com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator.<init>(Ljava/net/InetAddress;)V
The method's class, com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator, is available from the following locations:
jar:file:/D:/Local%20warehouse/com/baomidou/mybatis-plus-core/3.4.1/mybatis-plus-core-3.4.1.jar!/com/baomidou/mybatisplus/core/incrementer/DefaultIdentifierGenerator.class
It was loaded from the following location:
file:/D:/Local%20warehouse/com/baomidou/mybatis-plus-core/3.4.1/mybatis-plus-core-3.4.1.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator
解决办法由于
mybatis-plus-boot-starter版本太高导致
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.2.2.RELEASE</version> </parent>
建议使用
<!--Mp--> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>3.4.1</version> </dependency>