-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Corrected to set bean class instead of bean class name to factoryBeanObjectType of BeanDefinition attribute #865
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kazuki43zoo
changed the title
Corrected to set bean class instead of bnea class name to factoryBeanObjectType of BeanDefinition attribute
Corrected to set bean class instead of bean class name to factoryBeanObjectType of BeanDefinition attribute
Oct 23, 2023
…ObjectType of BeanDefinition attribute. Fixes mybatisgh-855 * Related with mybatisgh-494 * Related with spring-projects/spring-framework#29799
2 tasks
Thank you, @kazuki43zoo ! So, mybatis/spring-boot-starter#475 was not actually fixed? |
No, at least it worked fine for |
Okay, thanks! |
djkeh
added a commit
to djkeh/springmockk
that referenced
this pull request
Feb 1, 2024
This upgrade includes some changes of the test codes which corresponds to significant changes that have been made in Spring Boot 3.2. mybatis project encountered the same issue, so its pr helped a lot making this upgrade done. The brief explanations are: 1. As of Spring Framework 6.1, we can't pass the value of `factoryBeanObjectType` as `String` to `BeanDefinition`. 2. `BeanFactory.getBean()` in `BeanFactoryExtensions` has been changed. Good thing is, the changes above don't seem to affact the implementations. All we need to do is to correct the test code. For the details, please check the references below. ## Reference * mybatis pr: mybatis/spring#865 * as-is 1: https://github.com/spring-projects/spring-framework/blob/66f4509c2c7a1ad0255ed84f9e5efb340bd0b470/spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java#L74-L83 * to-be 1: https://github.com/spring-projects/spring-framework/blob/00577ed80acfc22104b41d6a631f433a3fa7e6af/spring-beans/src/main/java/org/springframework/beans/factory/support/FactoryBeanRegistrySupport.java#L74-L87 * as-is 2: https://github.com/spring-projects/spring-framework/blob/66f4509c2c7a1ad0255ed84f9e5efb340bd0b470/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanFactoryExtensions.kt#L28 * to-be 2: https://github.com/spring-projects/spring-framework/blob/00577ed80acfc22104b41d6a631f433a3fa7e6af/spring-beans/src/main/kotlin/org/springframework/beans/factory/BeanFactoryExtensions.kt#L29-L30
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes gh-855
Changes
We used the
factoryBeanObjectType
of BeanDefinition attribute for supporting@MockBean
/@SpyBean
provided Spring Boot via gh-494. But since Spring Framework 6.1, this attribute cannot pass value of String type. Thefore we change to pass the bean type instead of bean class name. This change valid on latest version of Spring Boot 3.0.x and 3.1.x and 3.2.x.Related Links
FactoryBean.OBJECT_TYPE_ATTRIBUTE
supported types spring-projects/spring-framework#29799