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

Fix the issue with MyBatis-Spring integration where MyBatis reloading is not functioning properly and results in a NullPointerException. #557

Merged
merged 2 commits into from
Aug 2, 2024

Conversation

homejim
Copy link
Contributor

@homejim homejim commented Aug 1, 2024

Fixes

  • When MyBatis runs in Spring-MyBatis mode, it encounters a NullPointerException and the reload fails.#556#550,,#538,
  • When MyBatis runs in Spring-MyBatis mode,there is no need to cache configuration-related data。The related reload operations are handled by SpringMybatisConfigurationProxy
  • When MyBatis runs in Spring-MyBatis mode,we only need to use SpringMybatisConfigurationProxy for reloading. Refreshing the ConfigurationProxy is not meaningful.The same applies in the opposite case.

…E) occurs during reload, and also differentiate between MyBatis and MyBatis-Spring modes
@homejim
Copy link
Contributor Author

homejim commented Aug 1, 2024

Hi, @skybber :
You can use my demo application to reproduce the issue with the original 1.4.2-SNAPSHOT. Modify the SQL, and you will encounter a NullPointerException along with the reload functionality not working. However, with the repackaged 1.4.2.1-SNAPSHOT that I provided, the error does not occur, and the functionality works correctly.

https://github.com/homejim/spring-mybatis-demo

@skybber
Copy link
Contributor

skybber commented Aug 1, 2024

Repository not found : https://github.com/homejim/spring-mybatis-demo

@homejim
Copy link
Contributor Author

homejim commented Aug 1, 2024

@skybber

Repository not found : https://github.com/homejim/spring-mybatis-demo

OK, I have set this repository to public.

This project uses an H2 in-memory database. After using Maven to download the dependencies, you can run it directly.

@skybber skybber self-requested a review August 1, 2024 17:10
Copy link
Contributor

@skybber skybber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pleas look at it

Fix the issue where using the insertAt method might fail due to changes in the processPropertyPlaceHolders method body. Add a list variable at the beginning of the method, include the factory in the list after factory initialization, and finally execute the removal logic at the end of the method.

Why not execute the removal right after initialization? I tried that, but it fails during reload.
@skybber
Copy link
Contributor

skybber commented Aug 2, 2024

It looks great now, thanks for contribution!

@skybber skybber closed this Aug 2, 2024
@skybber skybber reopened this Aug 2, 2024
@skybber skybber merged commit d0b1759 into HotswapProjects:master Aug 2, 2024
@homejim homejim deleted the issue_550 branch August 2, 2024 14:00
@homejim homejim restored the issue_550 branch August 2, 2024 14:01
@homejim homejim deleted the issue_550 branch August 2, 2024 14:02
@homejim homejim restored the issue_550 branch August 2, 2024 14:06
@homejim homejim deleted the issue_550 branch August 2, 2024 14:07
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 this pull request may close these issues.

2 participants