Announcement Announcement Module
No announcement yet.
Dependency Injection and Reflection API Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dependency Injection and Reflection API


    I am new Spring user .

    Spring dependency injection uses Reflection Api .

    I am not sure how Reflection API is working here and also when Already reflection Api was there what was need of Spring framework

    Can you please me understanding this better

    Many thanks

    Last edited by nehanarang786; May 28th, 2013, 05:04 AM.

  • #2
    Quoting spring site,
    A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.
    Quoting Marten Deinum

    Spring already uses reflection, next to that a bean managed by the container is much more than just a bean instantiated through reflection. You have all your post processors etc. applied, so for instance if you have some aspects configured those would also be applied to prototype scoped beans. Which you wouldn't have when you would use reflection inside your application.

    Next to that you don't want to have your application know HOW to construct an object, be it by reflection or calling new. You either just want to have it or want to call a simple factory (the ApplicationContext) to retrieve it.