Tag: java
-
Convert react app built with frontend-maven-plugin from webpack to vite
frontend-karaf-demo is a small demo application that uses frontend-maven-plugin and webpack to compile a react application into static files that are included as classpath resources into a jar file together with a servlet. This blogpost describes converting the build of this application from webpack to vite
-
Build Java records with builders
When writing Java record withers what and when I discovered that the Java beans with builders resulting from Build beans better with builders could have their boiler plate code size reduced to half, if they were turned into records instead of beans. This is the story of switching my Java beans to records and how…
-
Java record withers what and when
This blog post is the result of searching the internet to find out what Java records with “withers” will look like and in what version of Java records with withers will arrive. In addition, while trying to figure out Java withers, I discovered that reforming my current beans with builders into records with builders, I…
-
Build beans better with builders
Edit: I no longer use beans with builders, I Build Java records with builders Builders provide a nice, if verbose, way to create immutable java beans. The upsides are a nice syntax for creating immutable beans, and a way to provide copy-on-write behaviour for immutable objects. The downsides are the need for verbose boilerplate code,…
-
Chaining Optionals using flatMap and map
The blog post How I learnt to like Optional shows an example of how to chain Optional values safely, using Optional.orElse() to provide empty objects for the next level in the chain. This blog post uses Optional.flatMap() and Optional.map(), to achieve the same thing, without having to create the empty objects, and without doing any…
-
How I learnt to like Optional
I used to see Optional<Something> as a completely useless addition to Java, adding to the bloat of Java without being any clearer than checking if a reference is null. I have changed my mind, and now think Optional<> can be useful in making code simpler, easier to understand, and more robust. The reason I changed…
-
Installing apache karaf on debian
Until the RFP (Request For Packaging) bug for karaf in the debian bug tracker is resolved, here is an APT archive with a karaf package for debian (architecture “all”). The package is created using native debian packaging tools, and built from a source tarball and the APT archive itself is created, using aptly.
-
Packaging karaf with native debian packaging tools
Note! This is an improvement over the packaging in Installing apache karaf on debian stretch, this package is packaged using native debian packaging tools instead of fpm, and is built from the karaf source tarball instead of the karaf binary tarball. Apache karaf is an OSGi container and application server that is provisioned from maven, and…
-
Installing apache karaf on debian stretch
Edit: It is now possible to install karaf on debian without building it yourself, the package installed is not the one described here, but the new and improved package built from source with native debian packaging tools, that can be found here https://github.com/steinarb/karaf-debian
-
Making a Java windows service in 10 minutes
This blog post describes how to create a windows service from a Java application, it is a slightly more fleshed out version of the JavaZone 2016 lightning talk “A Java windows service in 10 minutes”. A problem sometimes encountered by a Java programmer, is to make your Java program into a Windows Service. This is may be a bump…