Welcome

Another Difference Between Autowire byType and constructor

Lets keep playing with autowiring behaviour of Spring Framework. Autowire byType or byName is not required by default. In other words, they will do nothing if they cannot find suitable candidates to inject into target beans. They can be made required in two different ways; One is to use @Required annotation in setter method if […]

Weird Autowiring Behaviour in Spring Framework

During lab sessions in our Enterprise Java trainings I usually leave the main track of lab outlines and start trying various cases related with the topic. It is a bit risky for me but it also becomes beneficial for attendees in terms of learning by experimenting with the framework. The risky point is that I […]

TransactionTemplate and Rollback Rules

When I was playing with TransactionTemplate during one of my Spring training sessions, I promptly suggested audience with trying to change default rollback rules while using TransactionTemplate. After all TransactionTemplate encapsulates boilerplate transaction begin, commit/rollback statements and we only give business logic part which it executes inside that begin…commit/rollback block. Because of this, I’ve thought […]

How to build SessionFactory in Hibernate 4

Well, I think it is the first time in Hibernate’s history that it is released with incomplete feature implementations and documentation. I came to this conclusion when I see Configuration.buildSessionFactory() method as deprecated. When I look at documentation however it still uses above method to create it! If you look at org.hibernate.cfg.Configuration class, it is […]

StringHttpMessageConverter DEFAULT_CHARSET Limitation for Turkish Content

Spring has its own REST support known as Spring Web MVC. Although, I am happy with its general capabilities, I came up with a small but very annoying problem or let’s say limitation related with its one of HttpMessageConverter‘s classes. Spring Web MVC make use of HttpMessageConverter classes both on server and client to handle […]

Sorting Your Beans With Spring OrderComparator

Sometimes you may need to execute your collection of beans in a a specified order. For example, in one of our projects, we have collection of EventHandlers which operate on when certain Events occur. For each event there might be more than one EventHandler instance that need to operate on. Most of the time it […]

Reassociated object has dirty collection reference

This is something really weird Hibernate error you may come up in several situations. When I first googled around, I found some sites commenting the source of error as “trying to attach a transient entity with the session, or entity with a collection not in type of PersistentCollection etc.” However, none of those cases maches […]

Adding New Permission Types to Spring Security ACL

Domain object level security is probably least used feature of Spring Security compared to url based and method level security features for enterprise Java web applications. However, when you have a security requirement something like “I want to restrict some operations which is allowed for some roles based on criteria that can be obtained from […]

Allowing roles without defining them in intercept-url element

Spring Security Framework has lots of authentication and authorization features, and almost all of them can be customized and extended according to your own needs. One of the common requests I come up with is that developers don’t want to explicitly define roles which have administrative priviledges in intercept-url elements like below; <intercept-url pattern=”/secured/*” access=”ROLE_ADMINISTRATOR,ROLE_USER,ROLE_EDITOR”/> […]

If Your Eclipse Hangs…

Recently, my STS installation started to freeze during “initializing java/spring tooling” step. As a first attempt, I suspended all validations from window>preferences>validation, however it didn’t help much. Whenever you experience a hang or freeze in your Eclipse installation, it is always a good habit to look inside of .metadata/.log file in Eclipse workspace folder. Most […]