简体   繁体   中英

Debug while bean creation

I know how to debug a normal program flow in eclipse. I want to know if there a way to debug the bean formation in eclipse using the spring framework.

Just debug the constructor. If there is none, create a default constructor and set a breakpoint into it.

In order to make a bean aware of its initialization you can implements InitializingBean interface and then implements

public void afterPropertiesSet() throws Exception {
      // I'm initializing
}

Could be a little "invasive" if it's only for debug reason, but this could be a way.

Another less invasive solution could be annotate a bean method with @PostConstruct .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM