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

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

内容简介:我正在尝试使用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"/>

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


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

查看所有标签

猜你喜欢:

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

Beginning ASP.NET 4 in C# and Vb

Beginning ASP.NET 4 in C# and Vb

Imar Spaanjaars / Wrox / 2010-3-19 / GBP 29.99

This book is for anyone who wants to learn how to build rich and interactive web sites that run on the Microsoft platform. With the knowledge you gain from this book, you create a great foundation to ......一起来看看 《Beginning ASP.NET 4 in C# and Vb》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具