I love Spring Framework, but it can be hard to bend it to your will. I have spent many hours fighting with it, and that is why I wanted to write my down my “war stories” and share them with you.
These stories won’t help you get started started with Spring Framework, but I promise that they will help you to solve some non trivial problems and save your precious time.
Introducing: My "War Stories"
- Adding Validation to a REST API describes how you can add JSR-303 backed validation to a REST API by using the @Valid annotation.
- New Like Expressions of Spring Data JPA describes how you can specify like expressions “inside” the invoked query.
- Using Environment Specific Cron Expressions With the @Scheduled Annotation describes how you can specify your cron expressions in properties files and use these expressions with the @Scheduled annotation.
- Invoking a Secured Method From a Scheduled Job describes how you can create a scheduled job that invokes a method which is secured by using the method security expressions of Spring Security.
- Using Null Values in DbUnit Datasets describes why you should use null values in your DbUnit datasets and explains how you can use them.
- Resetting Auto Increment Columns Before Each Test Method describes why you should reset the auto increment columns before each test method and explains how you can do it.
- Injecting Property Values Into Configuration Beans identifies the problems that you face when you inject individual property values into your Spring beans and describes how you can solve them.
- Returning Runtime Configuration as JSON describes how you can write the runtime configuration of your Spring web application to a log file and return it as JSON.
- Returning Git Commit Information as JSON describes how you can extract the build-time state of your Git repository, write it to a log when your Spring web application is started, and return the Git commit information as JSON.
- Parsing Date and Time Information From a Request Parameter describes how you can parse the date and time information from a request parameter by using the @DateTimeFormat annotation.
- Using Type Converters With Spring MVC describes how you can parse date and time information from request parameters by using Spring type converters.
- Creating PDF Documents With Wkhtmltopdf describes how you can create PDF documents with Spring Boot and wkhtmltopdf command line tool.
- Disabling Cookie Management of Apache HTTP Client 4 and RestTemplate helps you to ignore cookies when you are using Apache HTTP client 4 and RestTemplate.