我想調(diào)用該方法:https://github.com/spring-projects/spring-boot/blob/2.0.x/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/ ErrorProperties.java#L73但它不可用。它甚至不存在于反編譯代碼中。但它應(yīng)該是,因?yàn)?JavaDoc 說它從 1.3.0 版本開始可用并且它是公開的。我的版本是 2.0.0,我也查了 1.5.4。我提供的鏈接是針對(duì) 2.0.x 的,在 GitHub 中它仍然存在。但是在代碼中它不可用,為什么?聚甲醛:<?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> <groupId>test</groupId> <artifactId>test</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-autoconfigure</artifactId> <version>2.0.0.RELEASE</version> </dependency> </dependencies></project>代碼:import org.springframework.boot.autoconfigure.web.ErrorProperties;public class Test { ErrorProperties errorProperties = new ErrorProperties(); public Test() { //Cannot resolve method getWhitelabel() errorProperties.getWhitelabel(); }}
1 回答

慕后森
TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超5個(gè)贊
該方法不在 2.0.0 中,也不在 2.0.3 中,而是在 2.0.4(當(dāng)前最新版本)中。
將您更改pom.xml為:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<version>2.0.4.RELEASE</version>
</dependency>
</dependencies>
它會(huì)編譯。
添加回答
舉報(bào)
0/150
提交
取消