A Collection of Spring Tutorials

I started the REST Security project on github to explore writing an elegant REST Services with the latest and greatest Spring had to offer. That was Spring 3.1 and now Spring 3.2, moving towards Spring 4.0 and 4.1. Since then, the rest-security project has grown in complexity so I am now updating and migrating the tutorials to a simpler and more focused tutorials github project.

Core Spring Tutorials

Set up a web application with Spring and Java Configuration

Bootstrapping a web application with Spring and Java based Configuration. Discussion about a migration of the Spring configuration from XML to Java, starting with the web.xml.

REST Tutorial Service with Spring and Java Configuration

Building a REST Service with Spring and Java based Configuration, HTTP response codes, REST payloads and marshalling, testing.

Persistence Tutorials

Hibernate 3 with Spring

Setup Hibernate 3 with Spring – the Java and XML Configuration, integration with MySQL and usage best practices.

Hibernate 4 with Spring

Setup Hibernate 4 with Spring – the Java and XML Configuration, how to use and best practices.

JPA with Spring

Setup JPA with Spring – the Java and XML Configuration, the Maven dependencies and a generic DAO example.

The DAO with Spring and Hibernate 3

The DAO with Spring 4 and Hibernate 3 – focuses on Transaction Management, Hibernate Session management, Spring template best practices and common pitfalls.

The Persistence Layer with Spring Data JPA

Spring Data JPA with Spring – how to remove the DAO implementation, manual and automatic custom queries, transactions with Spring Data and configuration.

Simplify the Data Access Layer with Spring and Java Generics

How to simplify the Data Access Layer by using a single, generified DAO, which will result in elegant data access, with no unnecessary clutter. Yes, in Java.

Transaction Configuration with Spring and JPA

Transaction Configuration with Spring 4 and JPA – how to Enable and Configure Transactions and set up Transaction Propagation.

Next, on to the topic of REST

REST API Discoverability and HATEOAS

Implementation of HATEOAS and Discoverability for a Spring REST API.

HATEOAS for a Spring REST Service

Implementation of HATEOAS and Discoverability for a Spring REST API.

REST Pagination in Spring

Pagination in a Spring REST Service – URI structure and best practice, Page as Resource vs Page as Representation.

ETags for REST with Spring

ETags with the Spring – ShallowEtagHeaderFilter, integration testing of the REST API, and consumption scenarios with curl

Testing REST with multiple MIME types

Testing a REST Service with multiple Media Types/representations.

Exception Handling for REST with Spring

Exception Handling with Spring for a REST API. We’ll look at the older solutions available before Spring 3.2 and then at the new support in Spring 3.2 and 4.x.

Finally, we focus on Security

Spring REST Service Security

Secure a REST API with Spring Security 3 – the Spring Security Configuration, the web.xml, the HTTP status codes for authentication and the Maven dependencies.

Basic and Digest Authentication for a REST Service with Spring Security

How to Set Up and Configure both Basic and Digest Authentication for the the same REST Service, using Spring Security 3.

 

Further Topics to Explore

1. A request limitation mechanism for REST

2. Richer link semantics in REST and a ATOM based REST representation

In the meantime, you can check out the full implementation in the github project.

I usually post about Spring stuff on Google+ - you can follow me there:

 

>> GET THE EBOOKS <<
Get the eBooks and Learn to Build a Simple App
×
Build a Simple but Working App with Spring

, , ,

  • Sunil Nicholas

    Perhaps a stupid question, but I’m trying to build this project and I can’t pull down the test jars. The main source tree compiles fine, but I have compilation issues running rampant in the test source tree. Could this be a Maven issue? Is there anywhere I can pull down the necessary jars manually?

    • Eugen

      What kind of compilation issues are you experiencing? If you have anything specific actually not compiling, please open up an issue in github and I’ll take a look.
      Thanks.
      Eugen.

  • Gbondy

    Do you have an example of a Spring 3.1 bean configuration with annotations when there is a many-to-many relationship. Here is a sample of doing this with xml config

    org.hsqldb.jdbcDriver
    jdbc:hsqldb:hsql://localhost
    sa

    1
    org.hibernate.dialect.HSQLDialect
    true
    create-drop

    I have seen examples for including the properties but I have not found one that shows how to deal with mapping class.