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

Wrong usage of beanDefinition.getBeanClassName() #145

Closed
itineric opened this issue Sep 17, 2023 · 5 comments · Fixed by #222
Closed

Wrong usage of beanDefinition.getBeanClassName() #145

itineric opened this issue Sep 17, 2023 · 5 comments · Fixed by #222
Assignees

Comments

@itineric
Copy link

Starting from spring 6.0.11, existing code in this library may not work anymore. Some spring @Bean annotated with @Provider and other Jakarta-RS annotations are not recognized anymore (since getBeanClassName() is null) and are not registered in Resteasy as it was with srping version 6.0.10 and previous versions.

In the following class: https://github.com/resteasy/resteasy-spring/blob/main/resteasy-spring/src/main/java/org/jboss/resteasy/plugins/spring/SpringBeanProcessor.java , the calls to BeanDefinition.getBeanClassName() should be BeanDefinition.getResolvableType().toClass()

See: spring-projects/spring-framework#31242 (comment)

@liweinan
Copy link
Contributor

@itineric thanks for notifying this! I'll create PR for this.

@liweinan
Copy link
Contributor

@itineric I tried to replace the method however I got the null pointer exception. Could you please provide a working PR for this?

@snicoll
Copy link

snicoll commented Sep 18, 2023

To provide a bit more context, the existing code is using low-level code of the core container that it shouldn't. If you need to get the type of a bean beanFactory#getType(String beanName) is what you should be calling. I believe that static Bean method are not working either (with a recent or an older Spring release).

@liweinan
Copy link
Contributor

liweinan commented Dec 5, 2023

Sorry I have been dragged to other tasks for the last months, I'll come back to this issue then.

@liweinan liweinan self-assigned this Dec 5, 2023
liweinan added a commit to liweinan/resteasy-spring that referenced this issue Jan 16, 2024
@liweinan liweinan linked a pull request Jan 16, 2024 that will close this issue
liweinan added a commit to liweinan/resteasy-spring that referenced this issue Jan 17, 2024
@liweinan
Copy link
Contributor

@snicoll Thanks for teaching! I'll merge the PR which contains your suggestion of change :D

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

Successfully merging a pull request may close this issue.

3 participants