Spring Security Pre-Authentication with Spring Data JPA

Introduction In this example I am going to show you Spring Security Pre-authentication hasrole with Spring Data JPA. In my another example I had shown the similar example on Spring Security Pre-Authentication with Spring JDBC Template. There are situations where you want to use Spring Security for authorization, but the user has already been reliably authenticated by some external system…

Inject Prototype Bean into Singleton Bean in Spring – Lookup Method Injection

Lookup Method In this tutorial I am going to show you how lookup method injection works in Spring framework. You may face a situation where you need to inject prototype scoped bean into singleton scoped bean. For singleton scoped bean a new instance or object is created and the same is returned each time it is injected or looked up….

Top 10 best practices while building applications using Spring framework

Introduction In this tutorial I am going to discuss about best practices while building applications using Spring framework. Recently Spring has been one of the most popular Java based framework for building enterprise applications. Anyone can grasp the basic concepts and starts building applications using Spring right away but to become a strong developer you need to put efforts and…

Spring bean life cycle call back Methods Example

Spring framework provides bean life cycle call back methods to perform some additional tasks which you may want to perform when a bean is initiated or created or when a bean is about to get destroyed. Therefore you can run a method which will do some initialization process during bean initialization and you can run another method which will do…

InitializingBean and DisposableBean in Spring

Spring InitializingBean and DisposableBean are the interfaces used in life cycle of Spring beans management. Each of these interfaces has only one method. InitializingBean has a method called afterPropertiesSet() and DisposableBean has a method called destroy(). Spring container runs the method afterPropertiesSet() once the bean properties have been set and Spring container runs destroy() method once Spring container releases the…

Custom init() and destroy() methods in Spring

Introduction In this tutorial we will discuss on Spring custom init() and destroy() methods. These methods are call back methods which used in Spring life cycle. You can use these methods to to some initialization and clean up jobs just after the bean is created by the Spring container or just before the bean is about to be destroyed by…

BeanPostProcessor in Spring

BeanPostProcessor in Spring is used for extending the functionality of framework if want to do any configuration Pre- and Post- bean initialization done by spring container. By default, Spring will not aware of the @PostConstruct and @PreDestroy annotation. To enable it, you have to either register CommonAnnotationBeanPostProcessor or specify <context:annotation-config/> in the bean configuration file. Here CommonAnnotationBeanPostProcessor is predefined BeanPostProcessor…

Handling Default Exceptions in Mule

A catch exception strategy can be defined to customize the way Mule handles messages with errors. A catch exception strategy catches all exceptions thrown within its flow and processes them, thereby overriding Mule’s implicit default exception strategy. Mule’s catch exception strategy behavior is similar to a Java catch block, except that a new exception cannot be thrown or another exception…

Handling Global Exceptions in Mule

A catch exception strategy can be defined to customize the way Mule handles messages with errors. A catch exception strategy catches all exceptions thrown within its flow and processes them, thereby overriding Mule’s implicit default exception strategy. Mule’s catch exception strategy behavior is similar to a Java catch block, except that a new exception cannot be thrown or another exception…

Handling Local Exceptions in Mule

A catch exception strategy can be defined to customize the way Mule handles messages with errors. A catch exception strategy catches all exceptions thrown within its flow and processes them, thereby overriding Mule’s implicit default exception strategy. Mule’s catch exception strategy behavior is similar to a Java catch block, except that a new exception cannot be thrown or another exception…