Skip to content
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

Reinstate dependency injection support for legacy JSR-250 @javax.annotation.Resource annotation #30695

Closed
nzb15555196162 opened this issue Jun 20, 2023 · 4 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Milestone

Comments

@nzb15555196162
Copy link

nzb15555196162 commented Jun 20, 2023

spring-web 6.0.9

i just upgrade spring boot from 2.4.10 to 3.0.7. then spring-boot-starter-web auto upgrade from 5.3.9 to 6.0.9.

it have some compile error. i have fixed refer to the official document, but unfortunately all my spring bean cannot inject.

it make me annoy. in order to confirm the reason, i downgrade the springboot version to 2.4.10, and it works.

could someone help me?

see my snapshot upgrade version:

1687231035052
1687231071521

downgrade version:

1687231122144
1687231149920

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jun 20, 2023
@bclozel
Copy link
Member

bclozel commented Jun 20, 2023

Questions should be asked on Stack Overflow.

Could you ask this on StackOverflow? From the description of your problem it looks like a configuration error is likely.

Please provide a minimal sample application and a detailed stack trace on the StackOverflow question so we can help you.

@bclozel bclozel closed this as not planned Won't fix, can't repro, duplicate, stale Jun 20, 2023
@bclozel bclozel added status: invalid An issue that we don't feel is valid in: core Issues in core modules (aop, beans, core, context, expression) for: stackoverflow A question that's better suited to stackoverflow.com and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 20, 2023
@nzb15555196162
Copy link
Author

nzb15555196162 commented Jun 25, 2023

I have fixed this issue since our previous version was using @javax.annotation.Resource.

After the upgrade, this annotation can no longer be used for dependency injection. Instead, we now need to use @jakarta.annotation.Resource.

My question is why can't spring-web be compatible with this problem at the framework level?

Our business system is widely dependent on Spring. Although this is a small problem, it is a very important annotation for dependency injection.

My suggestion is that it is best to be compatible at the framework level, which is more friendly to Spring users.

@sbrannen
Copy link
Member

This request is analogous to #27444.

Since we opted to reinstate support for javax.annotation.PostConstruct and javax.annotation.PreDestroy, I think it is worth considering reinstating support for javax.annotation.Resource alongside jakarta.annotation.Resource in CommonAnnotationBeanPostProcessor.

In light of that I am reopening this issue and changing its title.

@sbrannen sbrannen reopened this Jun 25, 2023
@sbrannen sbrannen changed the title spring-web upgrade from 5.3.9 to 6.0.9 cause bean can not inject Reinstate dependency injection support for legacy JSR-250 @javax.annotation.Resource annotation Jun 25, 2023
@sbrannen sbrannen added type: enhancement A general enhancement status: waiting-for-triage An issue we've not yet triaged or decided on status: pending-design-work Needs design work before any code can be developed and removed status: invalid An issue that we don't feel is valid for: stackoverflow A question that's better suited to stackoverflow.com status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 25, 2023
@sbrannen sbrannen added this to the 6.1.x milestone Jun 26, 2023
@nzb15555196162
Copy link
Author

Understood, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

5 participants