There are different ways to test your Controller (Web or API Layer) classes in Spring Boot, some provide support to write pure Unit Tests and some others are more intended to be used for Integration Tests. Within this post, I’ll cover the main three test approaches available for Spring: using MockMVC in standalone mode, MockMVC together with SpringRunner, and using SpringBootTest.
If you use Ribbon and Eureka in your Spring Boot application, you’ll notice that the default configuration is not optimal. Eureka takes too long time to notice that a service went down unexpectedly and in the meantime, your load balancer, Ribbon, will try to connect to the dead one. On the other hand, the official Eureka documentation discourages changing the
leaseRenewalIntervalInSeconds parameter so, what can we do here? This post answers that question.
When we work with a Gateway Service like Zuul, probably we want to include a Circuit Breaker mechanism to avoid ugly errors in case of redirecting to a service which is unavailable or not responding in time. We can do that by connecting Hystrix with Zuul with a
ZuulFallbackProvider bean. Let’s see how.
In this article I’ll explain how to set up a basic
@RestController in a Spring Boot application, using both
@PostMapping annotations. Besides, this application includes Springfox Swagger so the REST API endpoints are documented and accessible through this tool.
Setting up a Spring Boot application using AMQP with RabbitMQ is not really difficult, and there are many guides on the Internet showing you the basic setup. But creating an application making use of @RabbitListener annotations and producing and consuming messages in JSON format is trickier, so I would like to share with you a really simple but more serious approach that those hello-messaging apps.
This article covers:
- How to send/publish Java Objects as JSON messages using Spring Boot and RabbitMQ RabbitTemplate.
- How to read/consume JSON messages to Java Objects using Spring Boot and RabbitMQ @RabbitListener annotation.
- How to send and receive Java Objects through RabbitMQ using default Java serializer.
Agile is about being fast and flexible at delivering value, but that doesn’t mean that you shouldn’t care too much about writing User Stories. The description you’ll add to them should not only enable communication and constructive feedback, but also motivate your team. Within this article I’ll try to expose what are the common pitfalls while writing a User Story, and how game designers have understood this before companies so you can apply gamification techniques to it.
One of the main metrics for a software project is Test Coverage: if done properly, it gives you a quick picture about how much code is ‘protected’ by tests.
In this article, I’ll show you how to use a minimal configuration for including JaCoCo in our Spring Boot application, and how to process this information with Sonar.
Within this post, I show you how to setup properly a Unit Test in Spring Boot performing HTTP requests with Mockito. In this case, I’m testing directly against data to be placed into the model, but a similar test could be written for checking a REST API.
Sometimes testing web access with Spring Boot can be tricky. There are some specific annotations to be used, being the configuration to use maybe the most important one.
Let’s say you want to connect your web/application with a third party REST API. Within this article I’ll put as example the SonarQube API, given that is the one I’ve used in my last personal project (see post).
In this post I’ll describe how I solved the situation of having no schema for the data that you’re retrieving from the REST API. How can we map this structure to Java Objects?
Logstash is a fantastic product to parse and process logs and events from other systems. You can store the resulting data in ElasticSearch and later visualize and analyze the results with Kibana. The combination of the three is called ELK and it produces a really powerful way of working with data, from processing and storing it to its visualization in many forms.
If you work with a web application deployed in JBoss or Wildfly (I’ll cover in this article Wildfly 8.2.0) you can send your all your logs or only the ones coming from your application to Logstash, for further processing. You can use it for example to visualize in Kibana how many errors your application threw, or how many times a specific event was triggered.