#1
16th February 2017, 05:30 PM
| |||
| |||
IOC Example In Spring
Hi I am doing a JAVA course from a institute right now so need to get an IOC example in spring framework so can you please help me in the same???
|
#2
17th February 2017, 04:32 PM
| |||
| |||
Re: IOC Example In Spring
Well the core of the Spring Framework is its Inversion of Control (Ioc) container. The IoC container manages java objects – from instantiation to destruction – through its BeanFactory. Java variants that are contained by the IoC container are known beans, and the IoC container settles a bean's scope, lifecycle events, and any AOP variants for which it has been managed and coded. A Spring bean in the IoC container can typically be any POJO (plain old java object). POJOs in this context are defined simply as reusable modular components – Example 1. DefaultMessage public class DefaultMessage { private String message = "Spring is fun."; /** * Gets message. */ public String getMessage() { return message; } /** * Sets message. */ public void setMessage(String message) { this.message = message; } } If the container instincts the message bean, it is equal to initializing an object in your code with new DefaultMessage() |
|