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

Spring RequestScope breaks SpringComponentProvider #3789

Open
jerseyrobot opened this issue Mar 21, 2018 · 1 comment
Open

Spring RequestScope breaks SpringComponentProvider #3789

jerseyrobot opened this issue Mar 21, 2018 · 1 comment

Comments

@jerseyrobot
Copy link
Contributor

Utilizing the new(ish) @RequestScope annotation causes integration issues as Spring is registering multiple bean names when this annotation is present. You now end up with originalBeanName and scopedTarget.originalBeanName as bean name entries in the context for the affected class.

The specific piece that breaks is:

if (beanNames == null || beanNames.length != 1) {
    LOGGER.severe(LocalizationMessages.NONE_OR_MULTIPLE_BEANS_AVAILABLE(component));
    return false;
}

The application still actually works in my parituclar case as Jersey was able to use the constructor and populate the other requested beans (from spring). This is dangerous though, as it will have hidden side affects as the resources is not actually being provided by Spring when we expect to be and things like @Transactional or other Spring specific things will fail. This seems like a red flag as well, should something more severe be done in these cases? Fail faster?

Note: There is a valid workaround, just use the old @Scope annotation. That does not register another bean name

@jerseyrobot
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant