Spring Bean – Order of injecting properties

Problem Statement: We need to start some task, after injecting all properties. How to resolve this?

Solution: Dont / Never depend on order of injecting values into bean. It is not controlled.

import org.springframework.beans.factory.InitializingBean;

public class BeanName implements InitializingBean

public void afterPropertiesSet() throws Exception
    System.out.println( "It will be called after completion of properties setting.");
    //do whatever is required here.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s