java – 配置问题:spring-security-web类不可用.你需要这些才能使用

栏目: Java · 发布时间: 6年前

内容简介:我正在尝试使用Maven在我的春季网络应用程序上运行一些单元测试.该应用程序安装并运行正常,它生成一个可部署的war文件,一切正常(全部使用Maven).我的测试类(位于src / test /java中):但是我收到了错误:

我正在尝试使用Maven在我的春季网络应用程序上运行一些单元测试.该应用程序安装并运行正常,它生成一个可部署的war文件,一切正常(全部使用Maven).

我的测试类(位于src / test /java中):

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"file:C:/myProjects/myWebapp/src/main/webapp/WEB-INF/applicationContext-test.xml"})
@Transactional
public class MyTest {
...

但是我收到了错误:

Configuration problem: spring-security-web classes are not available. You need these to use <filter-chain-map>

Offending resource: URL [file:C:/myProjects/myWebapp/src/main/webapp/WEB-INF/applicationContext-test.xml]

运行Maven时>测试

我的pom依赖被定义为

<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.0.5.RELEASE</version>                
</dependency>

哪个默认编译范围, which should be OK ?当我将范围更改为测试并提供时,它返回相同的错误.

我的.classpath看起来像这样:

<classpath>
    <classpathentry kind="src" output="target/classes" path="src/main/java"/>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
    <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
    <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>

如何正确设置我的应用程序上下文和测试?


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Apache Modules Book

The Apache Modules Book

Nick Kew / Prentice Hall PTR / 2007-02-05 / USD 54.99

"Do you learn best by example and experimentation? This book is ideal. Have your favorite editor and compiler ready-you'll encounter example code you'll want to try right away. You've picked the right......一起来看看 《The Apache Modules Book》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

随机密码生成器
随机密码生成器

多种字符组合密码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换