Whilst working with Java I have come across a number of libraries that have either proved to be useful or look very useful, so here I am going to mention some of them, however I will also list frameworks. First, let's explore the difference between a library and a framework, as it is an interesting subject. Naturally the industry does not have precise definitions on these, so having reflected on this and spoken to some people, this is my take on it.
A library is a small, focused extension or addition that adds functionality that I want, and I can just use. Quite simply it is a building block, something I can easily add in to solve a specific problem. My code will call the library, or in some way trigger it.
A framework on the other hand is much bigger and more powerful and is likely to be something that you build on top of, as it will force you to work in a particular way. Unlike a library, a framework tells you how to do something and in that sense is "controlling". Often with a framework you will find it is the one calling your code and actually driving the flow.
Adding a library during development is easy, adding a framework is not as it is a fundamental change. With libraries you can usually use several of them together, whilst frameworks are things you need to choose up front and you can only have one. With a library you can pick and choose which parts of the library that you want to use, unlike a framework which will impose a design or way of working on you, although you might not use all the functionality of the framework.
Looking at Spring for example you will find that it is common for Spring to call your code, unlike an Apache Commons library that is code you call, although one could argue that if the framework is calling your code then maybe it is a platform..... Without any further ado, let's crack on.
This a more like a suite of libraries, with each library being a separately run project, however there is some very good stuff here, so visit Apache Commons – Apache Commons and take a look.
If you want to reduce the amount of "boilerplate" code that you have for things like adding getter and setter methods to a Java object, then Lombok provides some very handy annotations to automate this for you. Visit Project Lombok and take a look, but do note that there are plugins for using Lombok in IntelliJ and Visual Studio Code as well as support for Maven and Gradle. These plugins are important for code completion and intelligent IDE features.
These are some useful links for getting more information on Lombok:
I have found using @EqualsAndHashCode.Exclude
and @ToString.Exclude
useful for preventing stack overflows on infinite loops due to circulars references. Another handy one is @Getter(AccessLevel.NONE)
, which then allows you to write your own getter.
At present I have not actually used this but in summary it is a handy library for testing REST services from Java code, see REST Assured for more details.
A very handy and easy to use webDAV library, lookfirst/sardine: an easy to use webdav client for java is will worth looking at if you need to add webDAV support.
There are many ways to solve the problem of parsing and manipulating HTML but I have found jsoup: Java HTML parser, built for HTML editing, cleaning, scraping, and XSS safety both useful and effective. The only issue I had with it was how it handles <br> tags, in that it was converting <br /> to <br>, which is valid for HTML but the system I was using did not like this, hence I needed to change the OutputSettings Syntax to xml, see Document.OutputSettings.Syntax (jsoup Java HTML Parser 1.14.2 API).
This is one of the biggest frameworks and one that is very well known, see Spring Framework for more details.
This is a list of things I have come across, look interesting, but I have not used