Enable preview of Spring REST Docs snippets in IntelliJ IDEA

If you use Spring REST Docs, you will be using the Asciidoctor include¬†directive a lot to include the request and responses that are generated from the unit tests. Drawback is that the Asciidoctor plugin for IntelliJ IDEA will not render them by default and looks like this: The reason is simple, the snippets¬†attribute is only…

Using ServletUriComponentsBuilder with Nginx

Spring’s¬†ServletUriComponentsBuilder.fromCurrentRequest() can be really convinient to build an URL from the current request. However, when using Nginx, things might work so well. The solution is simple, just add these headers to your Nginx configuration file: proxy_set_header X-Forwarded-Host $host:443; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-Port 443; proxy_set_header X-Forwarded-Proto https;

Angular-datatables with server side pagination using Spring Data

We are using angular-datatables in a project. So far, we just returned all entities from the server’s REST controller (Using Spring Boot and Spring Data on the server side). I wanted to see how I could implement server side pagination to avoid returning all records at once. I was lucky to find spring-data-jpa-datatables which makes…