Skip to content

Commit 76c1766

Browse files
committed
Support spring.aot.enabled=true
Fixes mybatisgh-780 Fix to use the AotDetector#useGeneratedArtifacts() instead of NativeDetector.inNativeImage() for set the includeAnnotationConfig to false on the ClassPathMapperScanner
1 parent 40bb693 commit 76c1766

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/mybatis/spring/mapper/ClassPathMapperScanner.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2022 the original author or authors.
2+
* Copyright 2010-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@
2727
import org.mybatis.spring.SqlSessionTemplate;
2828
import org.springframework.aop.scope.ScopedProxyFactoryBean;
2929
import org.springframework.aop.scope.ScopedProxyUtils;
30+
import org.springframework.aot.AotDetector;
3031
import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition;
3132
import org.springframework.beans.factory.config.BeanDefinition;
3233
import org.springframework.beans.factory.config.BeanDefinitionHolder;
@@ -87,7 +88,7 @@ public class ClassPathMapperScanner extends ClassPathBeanDefinitionScanner {
8788

8889
public ClassPathMapperScanner(BeanDefinitionRegistry registry) {
8990
super(registry, false);
90-
setIncludeAnnotationConfig(!NativeDetector.inNativeImage());
91+
setIncludeAnnotationConfig(!AotDetector.useGeneratedArtifacts());
9192
setPrintWarnLogIfNotFoundMappers(!NativeDetector.inNativeImage());
9293
}
9394

0 commit comments

Comments
 (0)