Skip to content
Advertisement

Tag: ioc-container

Garbage collector vs IOC

Today I attend the interview I am a newbie to java, spring boot. The interviewer asked the question about garbage collectors. I said the garbage collector will release the unused resource. Then he asked about the IOC container, I said it take control of object creation and will inject into the dependent bean. Then he asked why we need to

@PostConstruct annotation and spring lifecycle

I’m new to Spring, I would like to know: I have a java class annotated with @Component (spring) and inside I have a method annotated with @PostConstruct. The class is then referenced by @Autowired annotated field in another class. Can I assume that the class is only injected after @PostConstruct is called? Answer If you are asking is injection of

Advertisement