Home » Java » Page 10

Java

Java Based Akka application Part 1: Your base Project

Akka is a free, open-source toolkit and runtime for building highly concurrent, distributed, and resilient message-driven applications on the JVM. Along with Akka you have akka-streams  a module that makes the ingestion and processing of streams easy  and Alpakka, a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka. On this blog I shall focus ...

Read More »

Start a Java app without installing it

This article describes how you can use JShell to download and execute a Java application. It will eliminate the need for the installation of the application. Do not install, just run! The first obstacle that you have to overcome to make people use your app is the installation.You want people to use the app, try it out.To do that, they ...

Read More »

Run method on Spring Boot startup

spring-interview-questions-answers

While developing a spring boot application, sometimes we need to run a method or a piece of code at startup. This code can be anything ranging from, logging certain information to setting up database, cron jobs etc. We cannot just put this code in constructor, because required variables or servies may not be initialized yet. This could lead to null pointers or some ...

Read More »

AWS CodeBuild Error: Unable to access jarfile

java-interview-questions-answers

Using AWS CodeBuild, I was using a buildspec that was to run an executable JAR file to execute JUnit tests. Here is my buildspec: 1 version: 0.2 env:   secrets-manager:     CLIENT_ID: AppSecrets/someapp:CLIENT_ID     CLIENT_SECRET: AppSecrets/someapp:CLIENT_SECRET phases:   install:     runtime-versions:       java: corretto11   build:     commands:       - echo $CLIENT_ID       - echo $CLIENT_SECRET       - java -jar -DclientId=$CLIENT_ID -DclientSecret=$CLIENT_SECRET junit-platform-console-standalone-1.7.0.jar -cp myapp.jar --select-package="com.wall.steve" As you can see, I ...

Read More »

Java 15: Sealed Classes

Java 15 introduces Sealed Classes, a preview language feature, that allows classes/interfaces to restrict which other classes/interfaces may extend or implement them. Here is an example: 1 2 3 4 5 public sealed class Vehicle permits Car, Truck, Motorcycle { ... }   final class Car extends Vehicle { ... } final class Truck extends Vehicle { ... } final ...

Read More »

Locking for multiple nodes the easy way: GCS

It happens to all of us. We develop stateless applications that can scale horizontally without any effort.However sometimes cases arise where you need to achieve some type of coordination. You can go really advanced on this one. For example you can use a framework like Akka and it’s cluster capabilities. Or you can go really simple like rolling a mechanism ...

Read More »

Java String to String Array Conversion Examples

A quick and practical guide on how to convert String to String Array in differnet ways in java. 1. Overview In this article, you’ll learn how to convert String to String Array in java with example programs. Let us learn the different ways to do the conversion into a string array. from a string value. 2.  Using the split() method ...

Read More »