简体   繁体   English

无法解析符号org.springframework.test.web.server

[英]Cannot resolve symbol org.springframework.test.web.server

I cannot import org.springframework.test.web.server for testing my application. 我无法导入org.springframework.test.web.server来测试我的应用程序。 So the following line will not compile. 因此,以下行将无法编译。

mockMvc.perform(get("/players"))

Here is my pom.xml: 这是我的pom.xml:

pom.xml 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>

<groupId>com.guillaumeproject</groupId>
<artifactId>beer-pong</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>beer-pong</name>
<description>Beer pong challenge web app.</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.3.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
</properties>

<dependencies>
    <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>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

I think the required dependency should be 我认为所需的依赖关系应该是

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <scope>test</scope>
</dependency>

or 要么

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

Thank you for your help. 谢谢您的帮助。

So I figured out the package I need is servlet and not server. 所以我弄清楚我需要的包是servlet而不是服务器。 I don't know if the package was renamed tough. 我不知道该程序包是否已重命名。

Anyway thanks for the help! 无论如何,谢谢您的帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IntelliJ:无法解析符号“springframework” - IntelliJ: Cannot resolve symbol 'springframework' 创建bean&#39;org.springframework.security.filterChains&#39;时出错:无法解析&#39;org.springframework.security.web.DefaultSecurityFilterChain#0&#39; - Error creating bean 'org.springframework.security.filterChains': Cannot resolve 'org.springframework.security.web.DefaultSecurityFilterChain#0' 常春藤无法解析org.springframework依赖项 - ivy cannot resolve org.springframework dependencies 使用键[0]设置bean属性“ sourceList”时,无法解析对bean&#39;org.springframework.security.web.DefaultSecurityFilterChain#0&#39;的引用 - cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#0' while setting bean property 'sourceList' with key [0] 无法访问org.springframework.web.WebApplicationInitializer - cannot access org.springframework.web.WebApplicationInitializer 即使添加依赖项后,也无法解析导入org.springframework - import org.springframework cannot be resolve even after adding dependencies org.springframework.boot.context.event.ApplicationFailedEvent无法转换为org.springframework.boot.web.context.WebServerInitializedEvent - org.springframework.boot.context.event.ApplicationFailedEvent cannot be cast to org.springframework.boot.web.context.WebServerInitializedEvent Junit测试方法-无法解析符号&#39;.ok()&#39; - Junit test method - cannot resolve symbol '.ok()' org.springframework.test也无法解决,同时存在maven依赖项 - org.springframework.test cannot be resolved also with maven dependency present “无法解决符号'springframework'” - "Cannot reslove symbol 'springframework'"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM