Antonio Anzivino opened SPR-16029 and commented
I am working on a software project being a platform for other developers to make their web applications. We have a lot of internal patterns, then.
One pattern is that all MVC controllers must be request-scoped. They extend a common ancestor Another pattern is that schedulable processes (extending a common ancestor) have to be prototypes as an additional protection from concurrent calls.
I noticed that annotating the base class with @RequestScope
does not apply the scope to all controllers, having found that a lot of people forget to annotate their controllers as such. This, plus the fact that people store authentication/session information as class properties, resulted in confusion.
It would be nice
(to provide guidance to developers extending abstract classes)
If Spring adds the @Inherited
annotation to at least the @Scope
annotation. The full list of annotation that should be inherited is up to the Spring developers. I imagine that @Profile
could be a candidate.
For the record, @Transactional
is already @Inherited
and rocks!
Affects: 4.3.11
Comment From: spring-projects-issues
Antonio Anzivino commented
Related: #8859 Related: SEC-148
Comment From: spring-projects-issues
Juergen Hoeller commented
This turns out to be in conflict with our composable annotation model where we want locally declared composed annotations to overide raw annotations in base classes. So instead of declaring the annotations themselves as @Inherited
, we'd rather revise our lookup algorithm to explicitly check base classes as well. This is different between bean-declaring annotations and interception-causing annotations, so @Transactional
isn't an ideal role model here.
Comment From: snicoll
There hasn't been further interest from the community for this issue and, while the convenience described here is understandable, it isn't without drawback as described above. Furthermore, with the related issue being declined, this should be as well for consistency.