This blog post is outdated! If you want to learn how you can write unit tests for Spring MVC controllers, you should take a look at my updated Spring MVC Test tutorial. It describes how you can write unit tests for Spring MVC controllers with JUnit 5. Writing unit tests for Spring MVC controllers has […] Read More about Unit Testing of Spring MVC Controllers: Configuration
Blog (81 / 94)
Why I Changed My Mind About Field Injection?
I used to be a huge fan of field injection. But one day I started to question myself. Could it be possible that I have been mistaken? Let's find out what happened. Can It Be Too Simple? I was, of course, aware of the fact that field injection versus constructor injection versus setter injection is […] Read More about Why I Changed My Mind About Field Injection?
The Biggest Flaw of Spring Web Applications
The developers who are using Spring Framework in their applications are good to talk about the benefits of dependency injection. Unfortunately, they are not so good to leverage its benefits such as the single responsible principle and separation of concerns in their applications. If we take a look at any Spring powered web application, the […] Read More about The Biggest Flaw of Spring Web Applications
Spring From the Trenches: Using Environment Specific Cron Expressions With the @Scheduled Annotation
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
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