Normally objects are initialized and bound in code itself. Inversion of control is a approach to bind object at runtime using a binder program.

IoC is design patter to give control to components, while it usage Dependency Injection DI to achieve that. DI is helps us giving framework to bind the object at runtime. Example of IoC are,

Bean creation in Spring XML

<bean id="someBean"/>
<bean id="someBean" factory-method="getSingeltonObject"/>
<bean id="someBean"  factory-bean="SomoeFactoryClass" factory-method="getSingleToOfSomeFactoryClass"></bean>

Bean scope

 <bean id="someBean" class="com.packahe.DemoBean" scope="session" />
@Service
@Scope("session")
public class SomeBean
{
   //Some code
}