我正在尝试运行我的第一个springboot应用程序,但遇到了一些问题。
在我的应用程序文件中,这是我的代码
package com.clog.ServiceMgmt;
import java.util.List;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
@SpringBootApplication
@EntityScan("models")
@ComponentScan({"com.clog.ServiceMgmt","controllers", "models", "repositories"})
@EnableJpaRepositories(basePackages={"repositories"})
public class ServiceMgmtApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMgmtApplication.class, args);
}
}
但是当我运行我的应用程序时,出现以下错误。关于为什么我应该得到这个错误以及如何解决这个问题感到困惑。
org.springframework.core.annotation.AnnotationConfigurationException:
批注中的属性“ proxyBeanMethods”
[org.springframework.boot.autoconfigure.SpringBootApplication]是
在以下位置声明为@AliasFor不存在的属性'proxyBeanMethods'
注释[org.springframework.context.annotation.Configuration]。
嵌套的异常是java.lang.NoSuchMethodException:
org.springframework.context.annotation.Configuration.proxyBeanMethods()
这是我的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 http://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.0.BUILD-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.clog</groupId>
<artifactId>ServiceMgmt</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ServiceMgmt</name>
<description>Service Mgmt</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</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>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
有谁知道如何解决此问题?
谢谢
最佳答案
来自spring-projects-github
“ proxyBeanMethods是5.2中的新增功能,在堆栈的某些元素中可以看到5.1.2.RELEASE。”
做一个依赖关系:树并再次检查spring match> = 5.2,我有一个类似的问题,一个库从springboot带来了5.1覆盖v5.2
关于java - 运行Spring Boot应用程序时proxyBeanMethods注释错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55293320/