Below you can find very good guides how to handle CSRF tokens with Spring Security.
- CSRF tokens with Angular JS and Spring Security – official Spring guide
- Spring Security’s CSRF protection for REST services – client & server side by http://www.codesandnotes.be
- Logging out problem? Check this. – official Spring docs