Java developer blog

How to fix an exception at the first call with Zuul1 gateway

Overview Zuul is the first thing that comes to mind if you need to use a gateway with the spring framework. However, you will get an exception at the first call with default settings. In the post,...

How to override Java-style getters and setters in Kotlin

Overview Sometimes you may need to implement a Java interface for a Kotlin class. In the post, we are going to discuss how to override Java-style getters and setters for a Kotlin class. Example ...

How to create an entity for a view with the help of the Hibernate

Overview Using a view in a database is not popular nowadays as it was before especially with microservice architecture. However, you could face it in a project. A view is a virtual table based o...

How to implement equals() and hashCode() for a Kotlin entity

Overview In the previous post we have reviewed three ways of how to implement equals()/hashCode() for a Java entity. In the post we are going to describe how to implement equals()/hashCode() for ...

How to implement equals() and hashCode() for a Java entity

Overview Almost every web server has a database to store data. In Java backed application the most popular solution is to use Hibernate. Hibernate is used to map an object into an entry in a tab...

Spring boot with Mockito and Kotlin

Overview It’s a good practice to write a unit test to verify your code because it’s a basement of the Testing Pyramid. A unit test usually checks a single method. In most cases, it is hard to writ...

How to visualize OpenAPI (Swagger) with a Spring application

If you want to visualize OpenAPI on a server then you need to use swagger-ui. Swagger-ui is a React application embedded in an html page. You need a webserver to serve it to a client. The easiest w...

How to mark Java library as nullable

Sometimes it is useful to mark a Java library as Nullable so you will be able to use it safely from Kotlin. Let’s start with a simple example. The example consists of a kotlin project that depend ...

How to auto format Kotlin source code

Modern programming languages like Go and Rust use an additional tool that automatically formats source code according to the official code style. It helps to reduce bikeshedding significantly. Ko...

Java type hints in IDEA

Java 10 introduced a new var keyword that allows you to not declare type explicitly. I am not going to discuss the pros and cons of the feature. You could read about it more here if you want. How...