Category Archives: Java EE

Know how and programming examples for enterprise architectures and programming models. Explanations and usage of libraries and tools to develop enterprise models

Spring – Composite interceptor to create dynamic interceptor/advice chain

In my projects I reuse approved intercepter implementations. In in some cases I combine several interceptors to one interceptor or dynamicaly chains interceptors. In view of the method invocation the interceptors appears as one interceptor, or in other word as composition of interceptors. To support chaining of interceptors I implemented a CompositeInterceptor and a Interceptors utility class.

Read More...

Spring – Usage of @Primary annotation or attribut for inject default bean instances

For using dependency injection with Spring 3.0, several ways exists. You can use the annotation based way with the annotations @Service, @Repository, @Component or the JSR 330 @Named annotation or define the beans in xml with autowiring attributes or last but not least define the beans in a Java configuration. To wire up the injection targets you can use the @Autowired or the JSR 330 @Inject annotation or wire up the target in the XML bean definition.

Well the sense of this post isn’t to explain Spring dependency injection in deep. I will rather discuss what happens if Spring found multiple beans qualified for injection, and how you can help Spring to make the decision which is the right one bean. I use the JSR 330 annotations, The examples also works with the Spring annotations @Service and @Autowire.

Read More...

Spring – load multiple property based on utils properties code

With the utils namespace in Spring 3.0 you can load a property file and use the values in Spring EL expressions. Unlike the valued flexibilty of other Spring components, utils:properties lacks possibilty to add multiple property file locations. But there is no problem to support multiple property locations by usage of PropertiesFactoryBean, the source of util:properties

Read More...

Lucene Spatial Example

As you know deal with lucene spatial search is sometimes hard. To understand the basic functionality I searched for a simple example. Mike Haller explained in his post Spatial search with Lucene a good example of how lucene spatial works and he gives some example code based on Lucene 3.0.2. In this post I deal with lucene 2.9.3 and lucene spatial.

Read More...