Skip to content

sebastiankoltun-blog.com

  • Home
  • About me
Spring profiles with Maven
16 August 2019 / Spring

Spring profiles with Maven

How to set Spring active profiles with maven profiles? In this example we will setup configuration for Spring Boot profile activated by Maven.

(more…)
Continue Reading
spring-docker logo
12 February 2019 / Docker

PostgreSQL with Spring Boot on Docker

Today we will learn how to configure PostgreSQL with docker for Spring Boot application. At the end of this article you should have Spring Boot application running on Tomcat server connected via JNDI to PostgreSQL data source. (more…)

Continue Reading
utility-tools
10 February 2019 / Clean code

Are static utility classes bad?

Static utility classes are common in libraries and in user code. For example Java Math for basic mathematical calculations or DateUtils to operate on Date/LocalDate objects. It’s not always wrong to create and use them but sometimes using utility methods are considered code smell. I’ll try to explain when and why use or not to use such methods. This article is not only for Java language. Rules presented here can be universal in other OOPs(Object Oriented Languages) having similar mechanisms to Java statics.
(more…)

Continue Reading
mind map image
22 October 2018 / Learning

Java Mind Map

Java mind map is useful tool when you want to learn Java from scratch. Or if you are already experienced developer and you want to refresh your knowledge. Below you see a full Java mind map with general topics. It is based on Oracle documentation and some interview questions.
I decided to share this mind map, cause I’ve searched for good Java mind map and found only general ones.  So, if you preparing for an interview or learn from scratch, it’s perfect starting point 😉 (more…)

Continue Reading
docker logo image
16 September 2018 / Docker

Docker with Wildfly 13 and OpenJDK 10

Recently I started new project in which I needed to use Java modules. So I set up a maven project with Java 10 and pulled jboss/wildfly docker image. Unfortunately it turned out that official jboss image does not support JDK 9/10, probably because of new Oracle license. But I don’t know why they do not …

Continue Reading
hexagonal_architecture monolith-to-microservice
10 February 2019 / Clean code

Monolith to microservice

In last few years “microservices” term was very popular and almost everyone wanted to migrate their systems to such architecture. But what’s wrong with monolithic applications you may ask. Actually nothing. Monolith apps are as good as microservice apps. It’s not the case what is better. I don’t want to discuss what are the benefits …

Continue Reading
Command handler crossroads Iamge
8 July 2018 / Clean code

Command Handler Pattern in Java EE

I named it command-handler pattern, but actually it’s modified command pattern. In classic command pattern, we have Command class that handles action on a given object. You can see it in Switch example. First difference is decoupling of command and action execution. It also simplifies segregating read and write queries/commands (aka. CQRS). In command handler pattern, commands …

Continue Reading
5 June 2018 / Clean code

Best practice for passing method arguments

In this article I will present simple yet effective best practice for making code more readable by changing method arguments. It’s a good practice to only pass values, that the method requires, everything else ruins readability and causes tests to be more complicated. Following this simple rule we will check how it really affects code quality. We will start with example code of tax calculation, then we will try to refactor it to be more readable and testable. Note that the example is exaggerated and of course can be simplified but it visualizes the problem. Real world cases will be more complicated than that, so you can imagine how this little change can influence things.

intelij-method-args-image

(more…)

Continue Reading
25 May 2018 / Linux

Install Oracle Java JDK 10 on Ubuntu 17.10

In this article we will quickly install Oracle Java JDK 10 on Ubuntu 17.10 machine from terminal. There are multiple methods of doing it, some more easy and some more sophisticated, like using bash scripts. It always depends on use case, but we will do it as simple as it can be. For this moment Java 10 and Ubuntu 17.10 are fresh versions so you may find it useful like I did.

Install Oracle Java logo image

(more…)

Continue Reading
29 October 2018 / Testing

Mocking time in Java 8

Mocking time in Java 8 can be tricky.
At first take a look at use case scenario, it’s obvious but it’s a good starting point. First solution is to pass Clock instance as method parameter.
Second solution is to inject it as private field. The last solution does not need any fancy frameworks so you can use it on core Java.

Mocking time in Java 8 clocks image

(more…)

Continue Reading

About me

Sebastian Kołtun Java EE programmer from Poland with 4 years of commercial experience. Interested in photography, film music and electronics.

Recent Posts

  • Spring profiles with Maven
  • PostgreSQL with Spring Boot on Docker
  • Are static utility classes bad?
  • Java Mind Map
  • Docker with Wildfly 13 and OpenJDK 10

Archive

  • August 2019
  • February 2019
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018

Categories

  • Clean code
  • Docker
  • Learning
  • Linux
  • Refactoring
  • Spring
  • Testing

Tags

Clean code Design Patterns Docker Java Java8 JavaEE JUnit5 Learning resources Linux Maven Refactoring Spring Spring Boot Test Ubuntu Wildfly

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Newsletter

©2021 sebastiankoltun-blog.com - Powered by Simpleasy