首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行springboot应用程序时出错

运行springboot应用程序时出错
EN

Stack Overflow用户
提问于 2019-09-07 23:59:15
回答 1查看 1.4K关注 0票数 1

无法运行spring引导应用程序

尝试去除/C:/Users/SaurKumar/.m2/repository/org/springframework/data/spring-data-commons/2.1.10.RELEASE/spring-data-commons-2.1.10.RELEASE.jar的内容

代码语言:javascript
复制
 :: Spring Boot ::        (v2.1.8.RELEASE)

2019-09-08 05:22:05.217  INFO 2420 --- [           main] i.j.c.CourseApiDataApplication           : Starting CourseApiDataApplication on BLRLW8166 with PID 2420 (C:\Users\SaurKumar\Downloads\course-api-data\course-api-data\target\classes started by saurkumar in C:\Users\SaurKumar\Downloads\course-api-data\course-api-data)
2019-09-08 05:22:05.222  INFO 2420 --- [           main] i.j.c.CourseApiDataApplication           : No active profile set, falling back to default profiles: default
2019-09-08 05:22:06.110  INFO 2420 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-09-08 05:22:06.215 ERROR 2420 --- [           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:

    org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension.postProcess(JpaRepositoryConfigExtension.java:121)

The following method did not exist:

    org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/lang/String;

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

    jar:file:/C:/Users/SaurKumar/.m2/repository/org/springframework/data/spring-data-commons/2.1.10.RELEASE/spring-data-commons-2.1.10.RELEASE.jar!/org/springframework/data/repository/config/RepositoryConfigurationSource.class

It was loaded from the following location:

    file:/C:/Users/SaurKumar/.m2/repository/org/springframework/data/spring-data-commons/2.1.10.RELEASE/spring-data-commons-2.1.10.RELEASE.jar


Action:

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


Process finished with exit code 1
-----------------------------------------

pom.xml

代码语言:javascript
复制
<?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.1.8.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>io.javabrains</groupId>
    <artifactId>course-api-data</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>course-api-data</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.hibernate.javax.persistence</groupId>
            <artifactId>hibernate-jpa-2.0-api</artifactId>
            <version>1.0.1.Final</version>
        </dependency>

        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.11.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

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

</project>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-08 08:39:44

从日志中可以看出,Spring为groupId org.springframework.data选择了与spring-data-jpa提供的版本不同的版本。如果您可以匹配spring-boot-starter-webspring-data-jpa的版本,那么它应该可以工作。

快速修复:删除spring-data-jpa的版本号,在默认情况下它将获得最新版本,在您的示例中是2.1.10.RELEASE

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57838234

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档