-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the issue with MyBatis-Spring integration where MyBatis reloading…
… is not functioning properly and results in a NullPointerException. (#557) * Fix the issue in MyBatis-Spring mode where a NullPointerException (NPE) occurs during reload, and also differentiate between MyBatis and MyBatis-Spring modes * Update MyBatisTransformers.java 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. --------- Co-authored-by: hejiajin <Homejim5>
- Loading branch information
Showing
5 changed files
with
122 additions
and
11 deletions.
There are no files selected for viewing
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
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
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
19 changes: 19 additions & 0 deletions
19
...ugin/src/main/java/org/hotswap/agent/plugin/mybatis/transformers/ConfigurationCaller.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package org.hotswap.agent.plugin.mybatis.transformers; | ||
|
||
import org.apache.ibatis.session.Configuration; | ||
import org.hotswap.agent.util.ReflectionHelper; | ||
|
||
public class ConfigurationCaller { | ||
/** | ||
* Sets the value of the $$ha$inReload field in the given MyBatis configuration. | ||
* This field is used to determine if the configuration is in reload status. | ||
* | ||
* @param configuration The MyBatis configuration object to be modified. | ||
* @param val The value to set for the $$ha$inReload field. If true, | ||
* the configuration will be marked as being in reload status. | ||
*/ | ||
public static void setInReload(Configuration configuration, boolean val) { | ||
// Use ReflectionHelper to set the value of the $$ha$inReload field in the configuration object. | ||
ReflectionHelper.set(configuration, MyBatisTransformers.IN_RELOAD_FIELD, val); | ||
} | ||
} |
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