首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法解析junit的符号“SpringRunner”

无法解析junit的符号“SpringRunner”
EN

Stack Overflow用户
提问于 2017-04-11 07:35:08
回答 1查看 2.3K关注 0票数 0

我正在尝试使用Spring框架为我的第一个java项目编写一个junit测试。我在网上搜索了如何包含依赖项以便使用它,但一直遇到以下警告:

无法解析符号“SpringRunner”

在intelliJ的想法中。所以少了什么?这是我对gradle的依赖文件。

代码语言:javascript
复制
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-    plugin:1.5.1.RELEASE")
        classpath("org.springframework:spring-test:4.0.3.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    testCompile("org.springframework:spring-test:4.0.3.RELEASE")
    compile('com.google.maps:google-maps-services:0.1.18')
    compile("org.springframework.boot:spring-boot-starter-thymeleaf")
    compile("org.springframework.boot:spring-boot-starter-security")
    compile("org.springframework.boot:spring-boot-starter-data-mongodb")
    compile("org.springframework.boot:spring-boot-starter-web")
    testCompile('junit:junit:4.12')
    testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile("org.springframework.security:spring-security-test")
}
EN

回答 1

Stack Overflow用户

发布于 2018-03-13 03:38:08

尝试添加org.springframework.test.context.junit4.SpringRunner;

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43339522

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档