-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Jackson2 AOT contribution not registered when extending JdbcOAuth2AuthorizationService #1737
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
Comments
I would be happy to work on a pull request if my proposed changes make sense. |
@billkoch Thank you for reporting this.
I'm not sure why the String-based class equality check was used but it should use the class reference instead, as per your workaround. Would you be interested in submitting a PR for this fix? |
@jgrandja Thank you for the quick response! I'd be happy to submit a PR for this. 👍 |
…e subclasses Prior to this commit, String-based class name comparisons were used for determining if a bean was of type JdbcOAuth2AuthorizationService or JdbcRegisteredClientRepository. Now JdbcOAuth2AuthorizationService.class.isAssignableFrom(...) and JdbcRegisteredClientRepository.class.isAssignableFrom(...) is used so that any subclasses are detected and the necessary AOT hints are contributed. closes spring-projectsgh-1737
…e subclasses Prior to this commit, String-based class name comparisons were used for determining if a bean was of type JdbcOAuth2AuthorizationService or JdbcRegisteredClientRepository. Now JdbcOAuth2AuthorizationService.class.isAssignableFrom(...) and JdbcRegisteredClientRepository.class.isAssignableFrom(...) is used so that any subclasses are detected and the necessary AOT hints are contributed. closes spring-projectsgh-1737
Expected Behavior
When extending the
JdbcOAuth2AuthorizationService
orJdbcRegisteredClientRepository
, theJackson2ConfigurationBeanRegistrationAotContribution
should be registered.Current Behavior
The
Jackson2ConfigurationBeanRegistrationAotContribution
is not registered as an AOT contribution.Context
This is due to the
OAuth2AuthorizationServerBeanRegistrationAotProcessor
checking for the relevant classes by the String class name (i.e. "org.springframework.security.oauth2.server.authorization.JdbcOAuth2AuthorizationService" and "org.springframework.security.oauth2.server.authorization.client.JdbcRegisteredClientRepository").My current workaround is to provide my own
BeanRegistrationAotProcessor
implementation thatJdbcOAuth2AuthorizationService
andJdbcRegisteredClientRepository
are assignable fromregisteredBean.getBeanClass()
, and then use reflection to instantiate the package-privateJackson2ConfigurationBeanRegistrationAotContribution
:Is there a reason to use String-based class references over Class references?
The text was updated successfully, but these errors were encountered: