Исправьте путь к классу вашего приложения, чтобы он содержал одну совместимую версию org.springframework.data.jpa.repository.config - PullRequest
0 голосов
/ 23 января 2020

Я не могу понять, Ошибка, что мне делать? Исправьте путь к классу вашего приложения так, чтобы он содержал единственную совместимую версию org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension.registerBeansForRoot(JpaRepositoryConfigExtension.java:169)

The following method did not exist:

    org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension.registerIfNotAlreadyRegistered(Lorg/springframework/beans/factory/support/AbstractBeanDefinition;Lorg/springframework/beans/factory/support/BeanDefinitionRegistry;Ljava/lang/String;Ljava/lang/Object;)V

The method's class, org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension, is available from the following locations:

    jar:file:/C:/Users/HCL/.m2/repository/org/springframework/data/spring-data-jpa/2.0.2.RELEASE/spring-data-jpa-2.0.2.RELEASE.jar!/org/springframework/data/jpa/repository/config/JpaRepositoryConfigExtension.class

It was loaded from the following location:

    file:/C:/Users/HCL/.m2/repository/org/springframework/data/spring-data-jpa/2.0.2.RELEASE/spring-data-jpa-2.0.2.RELEASE.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension

я добавил последние версии зависимостей даже если он снова будет отображаться

пом. 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.2.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa -->
<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa -->
<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>2.0.2.RELEASE</version>
</dependency>

        <dependency>
    <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>


        <!-- https://mvnrepository.com/artifact/javax.persistence/javax.persistence-api -->
<dependency>
    <groupId>javax.persistence</groupId>
    <artifactId>javax.persistence-api</artifactId>
    <version>2.2</version>
</dependency>
        <!-- https://mvnrepository.com/artifact/javax.transaction/jta -->

        <dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>2.3.15.2</version>
</dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

Пожалуйста, помогите!

Ответы [ 2 ]

1 голос
/ 24 января 2020

Вы не должны упоминать версию для spring-data-jpa. Родительская зависимость Spring-boot разрешит это автоматически.

Вместо этого:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <! -- <version>2.0.2.RELEASE</version>  comment or remove this line -->
</dependency>

Обновление: вы используете spring-boot-starter-parent версию 2.2.4 и другую версию spring-data-jpa, поэтому получаю ошибку.

0 голосов
/ 26 января 2020

Вместо spring-data-jpa и spring-boot-starter-jdb c вы должны использовать:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...