Posts

Showing posts from 2020

Getting started with Github Actions: Run JUnit 5 tests in a Java project with Maven

Github Actions is a CI/CD service provided by Github and it is free for public repositories. For private repositories, each GitHub account receives a certain amount of free minutes and storage, depending on the product used with the account.In this blog post, you will learn how to create a simple workflow for running JUnit 5 tests in a Maven based Java project and how to add a build status badge to a README.md file.

macOS: Notes app tips that may improve your daily workflow

Image
After switching from Windows to macOS in 2019 I also changed my default note taking app from OneNote to macOS build-in Notes.app. I wasn’t sure this is the right move, so I switched gradually with carefully selected topics only. But after several weeks of using both OneNote and Notes app I switched fully and after using Notes for several months now I would like to share some of my tips I find useful in my daily workflow.Note: This blog post is focused on macOS version of the app as I use it most of the time.

Convert time unit to duration in Java

java.util.concurrent.TimeUnit represents time durations in Java at a given unit of granularity and provides utility methods to convert across units. java.util.concurrent.TimeUnit was introduced back in the old Java days (1.5) but since then it has been extended several times already. In this blog post you will learn how to use java.util.concurrent.TimeUnit to convert a given time unit to a duration .

Switch as an expression in Java with Lambda-like syntax

As of Java 14, the switch expression has an additional Lambda-like (case ... -> labels) syntax and it can be used not only as a statement, but also as an expression that evaluates to a single value.

Record type in Java

Image
JDK 14, released in March 2020, introduced records (preview language feature) which provide a compact syntax for declaring classes whose main purpose is to hold data. In records, all low-level, repetitive and error-prone code is like constructors, accessor and utlity methods such as equals(), hashCode(), toString() are automatically derived based on the record’s state description.

macOS: sync files between two volumes using launchd and rsync

Backing up and syncing files and directories between drives is pretty common use case for many users. In this quick tutorial you will learn how to use launchd and rsync to synchronize files between different volumnes in macOS.

Spring Boot tests with Testcontainers and PostgreSQL, MySQL or MariaDB

Testcontainers is a Java library that allows integrating Docker containers in JUnit tests with ease. In a Containerized World, there is little sense to complicate the tests configuration with embedded databases and services. Instead, use run your services in Docker and let the Testcontainers manage this for you.In this blog post you will learn how to configure Testcontainers to run PostgreSQL, MySQL and MariaDB in Spring Boot 2 integration tests.This blog post covers:Testcontainers configuration (via JDBC URL Scheme) for Spring Boot 2 tests with PostgreSQL, MySQL and MariaDBTestcontainers in @DataJpaTest

Docker Compose for Spring Boot application with PostgreSQL

In this blog post you will learn how to configure Spring Boot application with PostgreSQL for running with Docker Compose.This blog post covers:Spring Boot application Dockerfile configuration with clean separation between dependencies and resourcesDocker Compose configuration for running the application with PostgreSQL

Deploy Quarkus application to AWS Elastic Beanstalk

Elastic Beanstalk allows deploying and managing applications in the AWS Cloud without having to learn about the infrastructure that runs those applications.With Elastic Beanstalk you can run a website, web application, or web API that serves HTTP requests but you can also run a worker applications for running long tasks. The Elastic Beanstalk supports several preconfigured platforms including Go, .NET or Java (Java 8 only) but also generic Docker platform.You simply upload your application with AWS CLI, AWS EB CLI or with the Elastic Beanstack console, and Elastic Beanstalk automatically handles the rest.In this blog post you will learn how to launch single container Docker environment with Quarkus based application on Elastic Beanstalk.

Quarkus tests with Testcontainers and PostgreSQL

Testcontainers is a Java library that allows integrating Docker containers in JUnit tests with ease. In a Containerized World, there is little sense to complicate the tests configuration with embedded databases and services. Instead, use run your services in Docker and let the Testcontainers manage this for you. So if you are need Redis, MongoDB or PostgreSQL in your tests - Testcontainers may become your good friend.In this blog post you will learn how to configure Testcontainers to manage PostgreSQL instance in Quarkus integration tests.

Getting started with Quarkus - build PetClinic REST API

Image
Quarkus - A Kubernetes Native Java stack tailored for OpenJDK HotSpot and GraalVM, crafted from the best of breed Java libraries and standards. - is a container-first framework optimized for fast boot times and low memory consumption. The framework is build on top of many popular Java libraries and it provides support for building standard REST as well as reactive and message-driven microservices. Thanks to the fast startup times and low memory usage Quarkus can also be used to implement functions in serverless environment. Quarkus gives a lot of possibilities to develop apps faster thanks to unified configuration, amazing live reloading features and tooling support.Learn how to get started with Quarkus and build a PetClinic REST API.This blog post covers:Requirements for development environmentCreating new projectDeveloping, building and running the application with Java 11Datasource configuration with Postgres and FlywayCRUD service with paginationCreating integration testsLive rel…

Set Visual Studio Code as default editor in jshell

Java Shell (jshell) is an interactive tool for learning and prototyping in Java. It was introduced with Java 9 and since then I use it ocassionally either for some quick prototyping, during presentations or simply to verify new features in the Java language. Since jshell is a command line tool (with basic intellisense) editing files in jshell is not the best expierience. Fortunatelly, jshell allows changing the default editor and set it to the one of your choice, including Visual Studio Code, Atom or Sublime.

macOS: essential tools for (Java) developer

Are you considering macOS as your next operating system? Are switching from Windows or Linux to macOS? Do you want to develop in Java on macOS? Or maybe you are looking for tools to help you being more productive?Read about tools that are essential to me (after switching from Windows to macOS).

Manage multiple Java SDKs with SDKMAN! with ease

SDKMAN! is a convenient tool for managing parallel versions of multiple Software Development Kits. The tool is especially useful for Java developers as it supports SDKs for the JVM such as Java, Groovy, Scala, Kotlin and Ceylon. Gradle, Maven, Spring Boot and many others are also supported.