Spring: What is a destroy method. how is it declared and when is it called?

Spring: What is an initialization method and how is it decalred in a Spring bean?

The org.springframework.beans.factory.InitializingBean interface allows a bean to perform initialization work after all necessary properties on the bean have been set by the container. The InitializingBean interface specifies a single…

Spring: Scopes for Spring Beans. What is the default?

By default, all beans create in the Spring application context are created as singletons. That is to say, no matter how many ties a given bean is injected…

Spring: Dependency Injection using annotations (@Component, @Autowired)

Spring: Dependency Injection in XML, using constructor or setter injection

To declare a bean in Spring’s XML-based configuration is to add <bean> element. Example: <bean class=”com.oreilly.entities.RedSox”/> For lack of an explicitly given ID, the bean will be named…

Spring: Dependency Injection using Java Configuration

The key to creating a JavaConfig class is to annotate it with @Configuration. The @Configuration annotation identifies this is as configuration class and it’s expected to contains on…

Spring: What is the concept of a “container” and what is it’s lifecycle?

In Spring based application, your application object lives in the spring container. Spring Container creates the objects, wires them together, configures them and manages their lifecycle. The container…

Spring: What is meant by “application-context” and how you create one?

ApplicationContext is one of Spring container which is the core component of Spring. Another Spring core container is BeanFactory. Spring comes with several flavours of a application context:…

Spring: What is an interface and what are the advantages of making use them in Java?

Interface looks like a class but not a class. An Interface can have methods and variables just like the class but the method declared in the interface are…

Spring: What is Dependency Injection and what are the advantages?