我将此依赖项添加到我的项目中,以便我可以使用
WebClient
类:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<version>2.3.2.RELEASE</version>
</dependency>
我运行了
mvn clean install -U
,它成功下载了依赖项。然后我关闭了IntelliJ并再次打开它。 IDE 顺利地识别了依赖关系。但是,我不知道如何在我的代码中实际使用它......
如果我这样做:
WebClient webClient = new WebClient();
它只是抱怨它cannot resolve symbol "WebClient"
,它不建议我导入它。我尝试使用 import org.springframework.boot.*;
手动导入,但仍然无法识别该符号。关于如何解决这个问题有什么建议吗?
模块信息.java
module org.openjfx {
requires javafx.controls;
requires javafx.fxml;
requires java.sql;
opens agill.deshopp to javafx.fxml;
opens agill.deshopp.controllers to javafx.fxml;
opens agill.deshopp.components to javafx.fxml;
exports agill.deshopp;
}
pom.xml
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>agill.deshopp</groupId>
<artifactId>app</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>11</maven.compiler.release>
<javafx.version>13</javafx.version>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>${javafx.version}</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.32.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<version>2.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.projectreactor</groupId>
<artifactId>reactor-spring</artifactId>
<version>1.0.1.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>${maven.compiler.release}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>agill.deshopp.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
我通过导航到“查看 Maven 工具窗口”-->“您的项目”-->“依赖项”--> 右键单击要解决的依赖项,然后单击“下载源”来解决此问题。希望这能解决您的问题。 在此输入图片描述