springboot报错An attempt was made to call a method that does not exist.

这个问题网上坑太多,花了两三个小时才搞明白~
主要是父子依赖版本不一致造成的~
例如:我之前的pom文件中的版本如下:
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.7.RELEASE</version>
</parent>
<dependencies>
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-server</artifactId>
        <version>2.0.2</version>
    </dependency>
    <dependency>
        <groupId>de.codecentric</groupId>
        <artifactId>spring-boot-admin-server-ui</artifactId>
        <version>2.0.2</version>
    </dependency>
</dependencies>

springboot报错An attempt was made to call a method that does not exist.

将spring-boot-starter-parent版本号修改完毕即可,反过来修改上面的两个子依赖也是可以的~

 <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.2.RELEASE</version>
    </parent>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章