Book Image

Building a RESTful Web Service with Spring

By : Ludovic Dewailly
Book Image

Building a RESTful Web Service with Spring

By: Ludovic Dewailly

Overview of this book

Table of Contents (17 chapters)
Building a RESTful Web Service with Spring
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Testing security


Spring has good support for unit testing. Developers can add new dependencies to their Maven project to include Spring testing support as follows:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-test</artifactId>
    <version>4.1.6.RELEASE</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-test</artifactId>
    <version>4.0.1.RELEASE</version>
    <scope>test</scope>
</dependency>

Because we don't want these dependencies to be included in the released product, we specify test as the scope. Doing so will only make the libraries available on the classpath during testing.

In Chapter 7, Dealing with Security, we added security to the booking component of our sample property management system. For reference, we limited the access to the RESTful...