Jul 1, 2015

Creating custom JSF components or widgets library

If you are using JSF you can easily move some parts of your code and widgets/components into external library. Here I will describe how to do in quick and correct way.

In this particular example I will show you how to create your own JSF converters library, but you can use this approach to make any other JSF libraries. You can see complete example of working JSF library here https://github.com/javaplugs/jsf-plugs

Jun 5, 2015

Mybatis support for Java 8 time (JSR 310)

Mybatis is pretty cool library for mapping your database queries. Unfortunately it does not know anything about Java8 time API (JSR 310). Thus you can not yous in your POJO new date/time types like LocalDate, LocalDateTime, ZonedDate, ZonedDateTime etc.

You can solve this problem by creating your own mapper for mybatis, or you can use mappers I have created.

Jun 2, 2015

Synchronize code over multiple JVM instances on the same machine

Several years ago I had to build Java application which can have only one running instance on same computer. This leads me to idea using file lock to block other application instances from running.
Not so long ago I have extended this locking functionality and publish it as artifact absolutely with no reason.

Apr 21, 2015

JSF view scope for Spring beans

Hello everyone.

If you are using JSF with spring beans, than you may notice that there are no alternative for JSF view scope for spring beans.

If you will try to add JSF annotations to Spring beans - you will fail. It will not work because native JSF  beans actually have another context environment than spring. Thus all JSF annotations and configuration from faces-config.xml can not be applied to Spring beans.

Jan 2, 2015

Howto run only single Java application instance

Sometimes in software development you need to run only one application instance. If you want to do this in Java you will have to think about realization, because this feature is not implement in the standard Java language library. I've found 2 basic approaches to make it work. They are based on port lock and file lock concepts.

My code is based on the file lock idea, because I think that port lock usage is not really reliable because of possible conflict in ports usage. I was trying to create really reusable piece of code :) which can handle cross application and cross platrom lock.

Dec 1, 2014

Enum types in Java

An enum type is a type whose fields consist of a fixed set of constants. Common examples include compass directions (values of NORTH, SOUTH, EAST, and WEST) and the days of the week. Because they are constants, the names of an enum type's fields are in uppercase letters.

Customize django AdminSite and autodiscover your apps

Sometimes you need to create your own django AdminSite based class. But if you will do it you will loose autodiscover() function and some applications like admin_tools will not work with your application.

I will describe here how to enable auto discovering modules and patch side modules to make it work with new AdminSite based class instance.