kmj*_*kmj 4 maven-plugin pom.xml maven-3 spring-boot
我正在尝试将一些服务从一个 Spring Boot 项目迁移到另一个项目,当然存在很多问题,但除了我陷入困境之外,所有问题都已解决
更正应用程序的类路径,使其包含类 org.springframework.boot.sql.init.dependency.AnnotationDependsOnDatabaseInitializationDetector 和 org.springframework.beans.factory.config.ConfigurableListableBeanFactory 的兼容版本
这是我的 pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<!-- <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.5</version>
<relativePath/> <!– lookup parent from repository –>
</parent>-->
<groupId>com.hpw</groupId>
<artifactId>box</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>box</name>
<description>Box</description>
<properties>
<java.version>17</java.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.6.4</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.6.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.3.13</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.6.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.13.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.2.2</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>5.6.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.7.36</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<build.profile.id>local</build.profile.id>
<unit-tests.skip>true</unit-tests.skip>
<integration-tests.skip>true</integration-tests.skip>
</properties>
</profile>
<profile>
<id>dev</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<build.profile.id>dev</build.profile.id>
<unit-tests.skip>false</unit-tests.skip>
<integration-tests.skip>true</integration-tests.skip>
</properties>
</profile>
<profile>
<id>qa</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<build.profile.id>qa</build.profile.id>
<unit-tests.skip>false</unit-tests.skip>
<integration-tests.skip>true</integration-tests.skip>
</properties>
</profile>
<profile>
<id>stg</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<build.profile.id>stg</build.profile.id>
<unit-tests.skip>false</unit-tests.skip>
<integration-tests.skip>true</integration-tests.skip>
</properties>
</profile>
<profile>
<id>prod</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<build.profile.id>prod</build.profile.id>
<unit-tests.skip>false</unit-tests.skip>
<integration-tests.skip>true</integration-tests.skip>
</properties>
</profile>
<profile>
<id>singletier</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<build.profile.id>singletier</build.profile.id>
<unit-tests.skip>false</unit-tests.skip>
<integration-tests.skip>true</integration-tests.skip>
</properties>
</profile>
<profile>
<id>threetier</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<build.profile.id>threetier</build.profile.id>
<unit-tests.skip>false</unit-tests.skip>
<integration-tests.skip>true</integration-tests.skip>
</properties>
</profile>
</profiles>
</project>
Run Code Online (Sandbox Code Playgroud)
这是控制台的错误:
***************************
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:
org.springframework.boot.sql.init.dependency.AnnotationDependsOnDatabaseInitializationDetector.detect(AnnotationDependsOnDatabaseInitializationDetector.java:36)
The following method did not exist:
'java.lang.annotation.Annotation org.springframework.beans.factory.config.ConfigurableListableBeanFactory.findAnnotationOnBean(java.lang.String, java.lang.Class, boolean)'
The calling method's class, org.springframework.boot.sql.init.dependency.AnnotationDependsOnDatabaseInitializationDetector, was loaded from the following location:
jar:file:/home/kmj/.m2/repository/org/springframework/boot/spring-boot/2.6.4/spring-boot-2.6.4.jar!/org/springframework/boot/sql/init/dependency/AnnotationDependsOnDatabaseInitializationDetector.class
The called method's class, org.springframework.beans.factory.config.ConfigurableListableBeanFactory, is available from the following locations:
jar:file:/home/kmj/.m2/repository/org/springframework/spring-beans/5.3.13/spring-beans-5.3.13.jar!/org/springframework/beans/factory/config/ConfigurableListableBeanFactory.class
The called method's class hierarchy was loaded from the following locations:
org.springframework.beans.factory.config.ConfigurableListableBeanFactory: file:/home/kmj/.m2/repository/org/springframework/spring-beans/5.3.13/spring-beans-5.3.13.jar
Action:
Correct the classpath of your application so that it contains compatible versions of the classes org.springframework.boot.sql.init.dependency.AnnotationDependsOnDatabaseInitializationDetector and org.springframework.beans.factory.config.ConfigurableListableBeanFactory
Disconnected from the target VM, address: '127.0.0.1:46807', transport: 'socket'
Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗,因为我尝试了很多重新配置 Maven 的方法,但没有任何效果,我在项目配置方面还有很多东西需要学习
| 归档时间: |
|
| 查看次数: |
12441 次 |
| 最近记录: |