Skip to content

Commit 7c8977a

Browse files
committed
适配SpringBoot3.2.x
1 parent a903b48 commit 7c8977a

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pom.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>3.1.5</version>
8+
<version>3.2.0</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.example</groupId>
@@ -25,7 +25,7 @@
2525
<dependency>
2626
<groupId>com.baomidou</groupId>
2727
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
28-
<version>3.5.4-SNAPSHOT</version>
28+
<version>3.5.5-SNAPSHOT</version>
2929
</dependency>
3030
<dependency>
3131
<groupId>org.springframework.boot</groupId>
@@ -36,6 +36,7 @@
3636
<groupId>org.graalvm.sdk</groupId>
3737
<artifactId>graal-sdk</artifactId>
3838
<version>22.3.1</version>
39+
<scope>provided</scope>
3940
</dependency>
4041
</dependencies>
4142

src/main/java/com/example/nativedemo/MyBatisNativeConfiguration.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import org.springframework.beans.factory.config.BeanDefinition;
6262
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
6363
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
64+
import org.springframework.beans.factory.config.ConstructorArgumentValues;
6465
import org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor;
6566
import org.springframework.beans.factory.support.RegisteredBean;
6667
import org.springframework.beans.factory.support.RootBeanDefinition;
@@ -312,8 +313,11 @@ private void resolveMapperFactoryBeanTypeIfNecessary(RootBeanDefinition beanDefi
312313
Class<?> mapperInterface = getMapperInterface(beanDefinition);
313314
if (mapperInterface != null) {
314315
// Exposes a generic type information to context for prevent early initializing
315-
beanDefinition
316-
.setTargetType(ResolvableType.forClassWithGenerics(beanDefinition.getBeanClass(), mapperInterface));
316+
ConstructorArgumentValues constructorArgumentValues = new ConstructorArgumentValues();
317+
constructorArgumentValues.addGenericArgumentValue(mapperInterface);
318+
beanDefinition.setConstructorArgumentValues(constructorArgumentValues);
319+
beanDefinition.setConstructorArgumentValues(constructorArgumentValues);
320+
beanDefinition.setTargetType(ResolvableType.forClassWithGenerics(beanDefinition.getBeanClass(), mapperInterface));
317321
}
318322
}
319323
}

0 commit comments

Comments
 (0)