Announcement Announcement Module
Collapse
No announcement yet.
performance issues due to use of reflection API in dependency injection Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • performance issues due to use of reflection API in dependency injection

    I am using Spring DI in domain objects using @Configurable and @Resource annotations. The rate of domain object creation is very high in my app. Since DI uses reflection, I have found that it results in high memory usage and high GC. I have confirmed this using java heap tool. This impacts the performance of the system and I am forced to change the design.

    I came across the suggestion provided in
    http://blog.springsource.com/2008/01...ction-feature/
    regarding the use of AbstractInterfaceDrivenDependencyInjectionAspect to bypass reflection.

    Kindly note that I have a large variety of such domain objects which are created frequently and it is not possible to specify all the attributes to be injected by Spring, in a configureBean() as the list varies.

    Has anyone faced similar performance issues. Is yes, kindly share any resolution ideas.

    I would appreciate your advice in this regard.

    Thanks
    RK7

  • #2
    use @Component on your beans and do component-scanning, then use @Autowired on public setter methods. This way, Spring won't need to use reflection to dependency inject beans into other beans.

    Comment

    Working...
    X