如何解决在没有Spring Boot的情况下在servlet堆栈上测试Spring Router功能
我正在编写一个基于某些输入生成RouterFunction的库。现在,我尝试测试该功能,但仅找到有关如何使用WebTestClient测试该功能的教程,该WebTestClient仅与反应式堆栈中的RouterFunction一起使用。其他使用MockMVC的方法是使用Spring Boot。但是我不希望Spring Boot作为依赖项,因为该项目只是一个库。
那么,要在没有Spring Boot的情况下使用MockMVC测试路由器功能,我需要执行哪些配置步骤?
如果有帮助的话,这是我的依赖项:
plugins {
id 'java-library'
id 'java'
id 'war'
}
dependencies {
compile group: 'org.springframework',name: 'spring-webmvc'
compile project(':lib:generator-core')
providedCompile group: 'javax.servlet',name: 'javax.servlet-api',version: '4.0.1'
testImplementation group: 'org.junit.jupiter',name: 'junit-jupiter-api'
testRuntimeOnly group: 'org.junit.jupiter',name: 'junit-jupiter-engine'
}
test {
useJUnitPlatform()
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。