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

3.2.3 to 3.2.5 upgrade causes Mismatched number of generics #40581

Closed
bilak opened this issue Apr 30, 2024 · 1 comment
Closed

3.2.3 to 3.2.5 upgrade causes Mismatched number of generics #40581

bilak opened this issue Apr 30, 2024 · 1 comment
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid

Comments

@bilak
Copy link

bilak commented Apr 30, 2024

Hello,
when upgrading from spring boot 3.2.3 to 3.2.5 I'm getting following error:

java.lang.IllegalArgumentException: Mismatched number of generics specified for public class domain.core.repository.impl.EocsRepositoryFactoryBean<R extends org.springframework.data.jpa.repository.JpaRepository<T, java.lang.String>,T extends domain.core.domain.DistributedEntity>
	at org.springframework.util.Assert.isTrue(Assert.java:129)
	at org.springframework.core.ResolvableType.forClassWithGenerics(ResolvableType.java:1125)
	at org.springframework.data.repository.config.RepositoryConfigurationDelegate.getRepositoryInterface(RepositoryConfigurationDelegate.java:367)
	at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:189)
	at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:94)
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.lambda$loadBeanDefinitionsFromRegistrars$1(ConfigurationClassBeanDefinitionReader.java:376)
	at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:375)
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:148)
	at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:120)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:428)
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:289)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349)
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:118)
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:788)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:606)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:334)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1354)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343)

It's probably caused by this change

We have custom factory bean

public class EocsRepositoryFactoryBean<
    R extends JpaRepository<T, String>, T extends DistributedEntity> extends JpaRepositoryFactoryBean<R, T, String> {

The ResolvableType resolves just 2 type parameters while RepositoryConfigurationDelegate resolves 3 generics.

image

Maybe spring-data wasn't adapted to recent core change?

If you need a reproducible example, please let me know, but it might take some time.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 30, 2024
@wilkinsona
Copy link
Member

The Framework change has just added a null guard around generics. For cases where it's non-null, I don't think it's changed when an IllegalArgumentException will be thrown. I think this is more likely to have been caused by the changes to Spring Data Commons made in spring-projects/spring-data-commons@dd081d4 and spring-projects/spring-data-commons@88011e6.

Please open a Spring Data Commons issue so that they can investigate.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants