#java_programming

Steinar Bangsteinarb
2024-05-09

Java record withers what and when steinar.bang.priv.no/?p=650 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 wi

Steinar Bangsteinarb
2022-02-06

Build beans better with builders steinar.bang.priv.no/?p=480 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, approximately doubling the code size of the bean sourc

Steinar Bangsteinarb
2022-01-23

Chaining Optionals using flatMap and map steinar.bang.priv.no/?p=461 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 withou

Steinar Bangsteinarb
2022-01-06

How I learnt to like Optional steinar.bang.priv.no/?p=450 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 under

Steinar Bangsteinarb
2020-07-13

Composing applications with karaf features steinar.bang.priv.no/?p=310 I create web applications by first creating a set of OSGi bundles that form the building blocks of the application, and then use karaf features to pull the building blocks together to create complete applications that run inside apache karaf. The bundles are (in order of initial

Steinar Bangsteinarb
2020-07-12

How to get test coverage back in sonarcloud maven builds steinar.bang.priv.no/?p=353 I use travis-ci to build my github projects and use sonarcloud to do analysis of the builds. In the start of January 2020, the test coverage percentage on all sonarcloud projects suddenly dropped to 0%. This blog post explains why coverage percentage dropped to 0% and how to get the test coverage back in the … Continue reading

Steinar Bangsteinarb
2020-07-11

Simplified REST APIs from karaf using Jersey steinar.bang.priv.no/?p=342 I have written the Java class JerseyServlet which is intended as a base class for DS (Declarative Services) components providing Servlet services to the OSGi web whiteboard. The JerseyServlet simplifies the approach outli

Steinar Bangsteinarb
2020-07-10

Simplified delivery of react.js from apache karaf steinar.bang.priv.no/?p=332 -maven-plugin -router -saga This article is about a new servlet base class I have created to simplify serving up javascript frontends from the OSGi web whiteboard. This article won’t go into the structure of the files that must be ser

Steinar Bangsteinarb
2020-07-09

My OSGi story steinar.bang.priv.no/?p=306 OSGi is a Java plugin framework and module system that were initially created for supporting embdedded applications in the automotive industry. OSGi also forms the foundations for the Eclipse IDE plugin model. The plugin model of OSGi consists of components waiting for services and starting and exposing services when all of the dependencies are sat

Steinar Bangsteinarb
2020-07-08

Rewriting applications to use pax-jdbc-config and liquibase steinar.bang.priv.no/?p=292 -jdbc -jdbc-config After creating the post Pluggable databases for apache karaf applications I posted a link to the blog post in the karaf user mailing list, and the immediate response was, “why didn’t I just pax-jdbc-config instead?“. The answer to that is that I didn’t know a

Steinar Bangsteinarb
2020-07-06

Pluggable databases for apache karaf applications steinar.bang.priv.no/?p=265 -jdbc Edit: I no longer use this approach. I use pax-jdbc-config instead.  See the article Rewriting applications to use pax-jdbc-config and liquibase for details When creating databases for my apache karaf based web applications, I want the following things: A database-independent schema cr

Steinar Bangsteinarb
2020-07-05

A Java programmer’s guide to delivering webapp frontends steinar.bang.priv.no/?p=269 -maven-plugin When I started investigating (googling) web frontends, I found tutorials for various frameworks and I found tutorials using node.js to deliver frontends to web browsers on localhost. What I did not find, w

Steinar Bangsteinarb
2020-07-04

Use Jersey to provide REST APIs from karaf applications steinar.bang.priv.no/?p=261 Edit: creating a REST API using jersey has been made simpler, see Simplified REST APIs from karaf using Jersey for details. The sample application github.com/steinarb/jersey-demo demonstrates how to use Jersey to provide a REST API from a

Steinar Bangsteinarb
2020-07-03

Deliver react.js from apache karaf steinar.bang.priv.no/?p=255 -maven-plugin -router .js -saga Edit: delivering react.js has been made simpler, see Simplified delivery of react.js from apache karaf for details. A small barebones demo application/testbed, delivering a single-page web application from apache karaf,

Steinar Bangsteinarb
2020-07-01

Develop OSGi applications using karaf steinar.bang.priv.no/?p=238 Apache Karaf is a good platform for deploying OSGi based applications. Karaf is also a good platform for testing and debugging these applications. This article describes how to test and debug OSGi bundles and OSGi applications with karaf and eclipse. The basic flow of development, is: Build the application with maven

Steinar Bangsteinarb
2020-06-27

Installing apache karaf on debian stretch steinar.bang.priv.no/?p=209 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  github.com/steinarb/karaf-debi Apache

Steinar Bangsteinarb
2020-06-24

Making a Java windows service in 10 minutes steinar.bang.priv.no/?p=171 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 pro

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst