The @Scheduled annotation offers an easy way to create scheduled tasks in Spring powered applications. We can use it to schedule our tasks by using either periodic scheduling or cron expressions. Although period scheduling can also be useful, the cron expressions give us much more control over the invocation of the scheduled tasks. That is […] Read More about Spring From the Trenches: Using Environment Specific Cron Expressions With the @Scheduled Annotation
Category: Programming (29 / 37)
Spring Data JPA Tutorial: Integration Testing
My Spring Data JPA tutorial has taught us that we can create database queries and persist entities in the database by using special repository interfaces. This raises an interesting question: How can we write integration tests for our Spring Data JPA repositories because they are just interfaces? This blog post answers to that question. During […] Read More about Spring Data JPA Tutorial: Integration Testing
Spring Data Solr Tutorial: Adding Custom Methods to All Repositories
If we are using Spring Data Solr in a real life software project, the odds are that sooner or later we will face a requirement which states that our application must be able to communicate with both a local Solr server and a SolrCloud. At the moment, fulfilling this requirement means that we have to […] Read More about Spring Data Solr Tutorial: Adding Custom Methods to All Repositories
Spring from the Trenches: New Like Expressions of Spring Data JPA
Today's war story talks about the like expression handling of Spring Data JPA. Although I have written earlier about a better solution for implementing text based search functions, using an external search server like Solr is not a viable option if the implemented search function is rather simple. Let's consider the following example. Using the […] Read More about Spring from the Trenches: New Like Expressions of Spring Data JPA
Spring Data JPA Tutorial: Using Querydsl in a Multi-module Maven Project
I received a question from a reader of my Spring Data book last week and decided to publish my answer as a blog post. The question was: How can I use Querydsl with Spring Data JPA in a multi-module Maven project? This blog post answers to that question and describes how we can create a […] Read More about Spring Data JPA Tutorial: Using Querydsl in a Multi-module Maven Project
Spring From the Trenches: Adding Validation to a REST API
I am a bit ashamed to admit this but until yesterday, I had no idea that I can add validation to a REST API by using the @Valid and the @RequestBody annotations. This was not working in Spring MVC 3.0 and for some reason I had not noticed that the support for this was added […] Read More about Spring From the Trenches: Adding Validation to a REST API