Spring Boot

Spring Boot Sweets: Using Duration Type With Configuration Properties

Posted on by  
Hubert Klein Ikkink

With @ConfigurationProperties in Spring Boot we can bind configuration properties to Java classes. The class annotated with @ConfigurationProperties can be injected into other classes and used in our code. We can use the type Duration to configure properties that express a duration. When we set the value of the property we can use:

  • a long value with the unit to express milliseconds,

  • a value following the ISO-8601 duration format,

  • a special format supported by Spring Boot with the value and unit.

Continue reading →

Spring Boot Sweets: Using Configuration Properties With DataSize

Posted on by  
Hubert Klein Ikkink

With @ConfigurationProperties in Spring Boot we can bind configuration properties to Java classes. The class annotated with @ConfigurationProperties can be injected into other classes and used in our code. We can use the type DataSize to configure properties that express a size in bytes. When we set the value of the property we can use a long value. The size is then in bytes as that is the default unit. We can also add a unit to the value. Valid units are B for bytes, KB for kilobytes, MB for megabytes, GB for gigabytes and TB for terabytes.

We can also use the @DataSizeUnit annotation to specify the unit of the property in our class annotated with @ConfigurationProperties. In that case a the value without a unit assigned to the property is already in the specified unit.

Continue reading →

Spring WebFlux : reactor meltdown - slow responses

Posted on by  
Michel Breevoort

WebFlux is the reactive web framework for Spring. The programming model is easy but using it could be cumbersome if you don’t know the consequences when used incorrectly. This post will show what the consequences are when the reactive-stack is not used correctly. It will answer the question: why is my (health) endpoint sometimes so slow?

TL DR; Don’t block the event loop

Continue reading →

shadow-left