-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spring-di: support scopes on bean methods #2778 #2862
spring-di: support scopes on bean methods #2778 #2862
Conversation
- Fix NPE when org.springframework.context.annotation.Scope is used on a bean method - Change default bean implicit scope from dependent to singleton - Do not process non-spring annotations (i.e. an explicit singleton) in spring-di, to avoid adding duplicate scopes with Arc processor
* @return A CDI built in (or session) scope that mostly matches | ||
* the spring one. Websocket scope is currently mapped to @Dependant | ||
* and spring custom scopes are not currently handled. | ||
*/ | ||
private DotName getScope(final ClassInfo clazz) { | ||
if (!clazz.annotations().containsKey(SPRING_SCOPE_ANNOTATION)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I've changed ClassInfo#annotations() (all levels annotations in the class) to ClassInfo#classAnnotation() (only class-level annotations of the class). The former was causing NPE when trying to access a method-level annotation value via clazz.classAnnotation().value()
...ns/spring-di/deployment/src/main/java/io/quarkus/spring/di/deployment/SpringDIProcessor.java
Show resolved
Hide resolved
...ns/spring-di/deployment/src/main/java/io/quarkus/spring/di/deployment/SpringDIProcessor.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks!
Just a couple of comments, which are probably just questions and might not even require changes
Great stuff, thanks @rquinio! |
Fixes #2778