I have recently been learning Kotlin. While the original Kotlin Reference is quite good, it certainly contains too much text for me to quick-start with Kotlin after years of Java development. During reading the docs and testing some syntax I’ve made my own Kotlin tutorial, which consists mostly of source code. This is probably the only thing that is required for experienced Java developer to get started.

MongoDB stores by default all dates with time and timezone. What’s wrong with this approach? There’s definetly something wrong when related stackoverflow thread shows more votes for converting dates to string than keeping them using default BSON datetime with timezone.

This article describes how to create Spring Boot application with oauth2 authorization using password grant type. This grant type is appropriate for internal clients which we trust to get username and password from the user, like for example internal web UI or native mobile app.

Embedded Redisson Node is a service where you can execute asynchronous tasks using Redis with Redisson. This library is not bound to Spring whatsoever, so if you want to run your tasks in the Spring context you need to bind it manually. However, using Spring Boot with Devtools you may encounter some class loading problems between Redisson Node and Spring context, what I’ve today. Here is a quick howto what’s this about and how to overcome this
problem.

Doing some proofs of concept for the brand new microservices architecture using Spring Boot and Spring Cloud I’ve chosen few backing technologies for tests. To create serious web application we need at least a database, something for messaging and distributed session/cache. The most common choices as always come from Spring-supported technologies and my ones are PostgreSQL and MongoDB as databases (depending on if we need transactional database in the specific service or not), Redis as a distributed memory grid and RabbitMQ for messaging. Now it’d be nice to have everything working transparently under one transaction manager.

Thinking about new application architecture with Spring Cloud with Netflix OSS I’ve stuck on a problem of time you need to wait until the Ribbon client is ready to serve. It looks by default you need to wait 30s before server list is fetched from Eureka server and Ribbon load balancer can be used to route traffic to specific service. This is a pain in dev env because here we frequently need to restart services and test some results again and again. 30s is not an option, so I’ve been looking for decreasing this time what finally turned out to be a difficult thing.

JetBrains Hub is an user management tool enabling single sign-on across all JetBrains web applications (like YouTrack or Upsource). But it also can work as a standalone oauth2/saml provider what brings to mind to use it as a central users repository for a number of different applications. Like for example GitLab. They provide oauth2 profile for GitLab to allow sign-in to Hub using GitLab credentials (GitLab acts as oauth2 provider) but we’d like to do something opposite - to use Hub working as oauth2 provider for GitLab, and to sign-in to GitLab with Hub credentials.

We have been thinking recently about using some SQL views in our Hibernate application backed by postgresql. It looks feasible and even it enables great possibilities. Below quick snapshot from my testing app showing how it works.

Hibernate provides an option to lazy fetch single-sided (to-one) associations using lazy proxy or bytecode instrumentation. However, both approaches suffer some problems. Byte code instrumentation … requires byte code instrumentation, while lazy proxies can be really problematic regarding type casting and instanceof check especially in existing systems and framewors. But don’t worry. In few words below I’ll describe a solution I’ve figured out for the existing system to improve performance using lazy to-one overcoming casting problems and not using instrumentation.

This article will be about multiple joins in Hibernate model during super class fetch in JOINED inheritance mapping strategy, and generally how I significantly improved our system performance using some simple patterns. There’s a lot of stuff on internet about this (usually wrong approach), so here I’ll present my working solution for this problem.