Skip to content

Commit 769ce65

Browse files
committed
Set default value of spring.aot.repositories.enabled by detecting if AOT is enabled or not
Signed-off-by: Hyunsang Han <gustkd3@gmail.com>
1 parent 936bb31 commit 769ce65

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryConfigExtension.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.slf4j.Logger;
4040
import org.slf4j.LoggerFactory;
4141

42+
import org.springframework.aot.AotDetector;
4243
import org.springframework.aot.generate.GenerationContext;
4344
import org.springframework.beans.factory.ObjectProvider;
4445
import org.springframework.beans.factory.aot.BeanRegistrationAotProcessor;
@@ -87,6 +88,7 @@
8788
* @author Thomas Darimont
8889
* @author Christoph Strobl
8990
* @author Mark Paluch
91+
* @author Hyunsang Han
9092
*/
9193
public class JpaRepositoryConfigExtension extends RepositoryConfigurationExtensionSupport {
9294

@@ -338,8 +340,10 @@ public static class JpaRepositoryRegistrationAotProcessor extends RepositoryRegi
338340

339341
Environment environment = repositoryContext.getEnvironment();
340342

343+
String enabledByDefault = AotDetector.useGeneratedArtifacts() ? "true" : "false";
344+
341345
boolean enabled = Boolean
342-
.parseBoolean(environment.getProperty(AotContext.GENERATED_REPOSITORIES_ENABLED, "false"));
346+
.parseBoolean(environment.getProperty(AotContext.GENERATED_REPOSITORIES_ENABLED, enabledByDefault));
343347
if (!enabled) {
344348
return null;
345349
}

0 commit comments

Comments
 (0)