我试着学习使用HTTPClient。但是HttpClient client = HttpClient.newHttpClient();不起作用。
在IntelliJ中,我更新了编译器以使用Java 12,在pom.xml中,我将java.version属性设置为12。
在我编写import sun.net.www.http.HttpClient,之后,它会得到HTTPClient,然后newHttpClient()方法就不能工作了。对于这种方法,我需要import java.net.http.HttpClient;
这是我的pom.xml
代码语言:javascript运行复制
12
org.springframework.boot
spring-boot-starter-thymeleaf
org.springframework.boot
spring-boot-starter-web
org.apache.commons
commons-csv
1.8
org.springframework.boot
spring-boot-devtools
runtime
true
org.springframework.boot
spring-boot-starter-test
test
org.junit.vintage
junit-vintage-engine
org.springframework.boot
spring-boot-maven-plugin