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>

 

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