Description
Lari Hotari opened SPR-11864 and commented
In Grails there is a custom solution to optimize autowiring by name.
Grails autowires all objects that are retrieved from Hibernate (GORM) . That's why the performance of autowiring is really critical for Grails.
This is the BeanFactory implementation Grails uses:
https://github.com/grails/grails-core/blob/master/grails-core/src/main/groovy/org/grails/spring/beans/factory/OptimizedAutowireCapableBeanFactory.java
(or rev 6d3604a if that link is broken)
It would be nice to have some caching like this directly in Spring.
Some usecases (I was perf. testing with) were 300% faster with this change at the time I added that optimization, so it's quite important for Grails applications.
There are some drawbacks in the solution used in Grails. The use of the optimizations can be skipped for a single class by making the class implement the Aware marker interface.
I wouldn't recommend to use a similar implementation directly in Spring, but I'd like to see autowiring by name optimized for performance directly in Spring.
Affects: 4.0.5
Issue Links:
- Autowiring with @Autowired/@Inject get much slower than with @Resource as the number of classes increases [SPR-13086] #17677 Autowiring with
@Autowired
/@Inject
get much slower than with@Resource
as the number of classes increases - Performance regression for custom autowireBean calls with many properties [SPR-11875] #16494 Performance regression for custom autowireBean calls with many properties
2 votes, 6 watchers