ThreadLocal usage

The ThreadLocal is very helpful to keep some information available from anywhere in the application but it is very important to release it when the process ends, otherwise, the resource will never be free and can cause a memory leak. Here is an example of using TheadLocal to store data in a web application. I… Continue reading ThreadLocal usage

Access Spring context from web application

As I am using JSF with Spring, the beans managed by Spring are not accessible in my page, I used this Siegfried Bolz’s blog as a basis and used the facade pattern to hide access to the context. The Spring context is loaded when the application starts using ContextLoaderListener in the apllication web.xml: <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>… Continue reading Access Spring context from web application

MyBatis+Spring+Generics

As I was working on the data access layer of my project, I noted that I have a lot of stuff to do to be able to access the Mapper from my web layer just for some simple CRUD actions. Lot of stuff and even if I can detect some similarities, it’s not exactly the… Continue reading MyBatis+Spring+Generics