Is Spring Container is just like a jvm?
No, Spring is a Java framework. It provides classes you can use to run a Java application on a JVM.
Why is Spring IOC mainly used?
Learn what Inversion of Control is and you will understand why it is used so heavily.
If it is for creating the objects without using new operator? what is
wrong in using new operator?
The new
keyword forces compile time dependencies. Inversion of Control and Dependency Injection remove those dependencies, mostly through reflection.
If we are creating singleton objects and return the same object
whenever application wants, we are loading all the objects on server
start up? will that not make the application heavy?
You will usually want all those objects at startup so it's a non-issue. You can delay the initialization of those objects (beans) with lazy loading.
If it is so, then why we need spring core?
If what is so?
How is filter,bean post processor, aop is different?
The BeanFactory
creates and initializes beans. A BeanPostProcessor
is meant to wrap a bean in a proxy or modify that bean's properties. The javadoc has more details.
Aspect oriented programming is a style of programming. In order to implement it with plain old Java, you need to use JDK or CGLIB proxies. Those are applied using BeanPostProcessor
instances by wrapping the processed bean. Calls going to the target bean will be intercepted by the proxy which will (possibly) perform logic before delegating to the target bean. Java's AOP capabilities are almost completely limited to method calls.