Packaging of Java applications for Mac OS X with Maven on Linux or Windows

Apple uses application bundles for packaging applications. An application bundle is simply “a directory that allows related resources such as an application’s executable and its graphics to be grouped together, appearing as a single file to the user.” There are a couple of maven plugins which attempt to help creating application bundles. One of them … Read more

Using lambdas causes strange “variable X might not have been initialized” error

It’s been long time since Java 8 became publicly available but it is still surprising me a lot. Its spec is definitely worth reading. One of the things I recently stumbled upon is the fact that lambdas are not the same as anonymous classes. A compilation error reproducible only when building with maven was bugging … Read more

Why Java’s Runnable doesn’t let us throw exceptions but Callable does?

Recently coming across the subject I remembered that already questioned it in the past. While this seems obvious at first glance there is still something to clarify. Depending on the context, in some cases, adding throws declaration to the run method would be convenient since something exceptional may still happen and the code in the run … Read more

Local singletons in Spring

When developing applications using dependency injection containers there are times when having a single global scope is not enough. As an example, consider having multiple instances of some “heavy” component. Creating such components requires dependencies declared as singletons within the scope of a particular object hierarchy (usually rooted in the component itself), and as prototypes … Read more