diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/aot/CoreRuntimeHints.java b/spring-batch-core/src/main/java/org/springframework/batch/core/aot/CoreRuntimeHints.java index 5c818578c8..df2d888c56 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/aot/CoreRuntimeHints.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/aot/CoreRuntimeHints.java @@ -69,6 +69,7 @@ * @author Glenn Renfro * @author Mahmoud Ben Hassine * @author Alexander Arshavskiy + * @author Andrey Litvitski * @since 5.0 */ public class CoreRuntimeHints implements RuntimeHintsRegistrar { @@ -83,18 +84,9 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) { "java.util.concurrent.ConcurrentHashMap$Segment"); // resource hints - hints.resources().registerPattern("org/springframework/batch/core/schema-h2.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-derby.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-hsqldb.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-sqlite.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-db2.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-hana.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-mysql.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-mariadb.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-oracle.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-postgresql.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-sqlserver.sql"); - hints.resources().registerPattern("org/springframework/batch/core/schema-sybase.sql"); + hints.resources().registerPattern( + "org/springframework/batch/core/schema-{h2,derby,hsqldb,sqlite,db2,hana,mysql,mariadb,oracle,postgresql,sqlserver,sybase}.sql" + ); // proxy hints hints.proxies() @@ -130,19 +122,19 @@ public void registerHints(RuntimeHints hints, ClassLoader classLoader) { .proxiedInterfaces(SpringProxy.class, Advised.class, DecoratingProxy.class)); // reflection hints - hints.reflection().registerType(Types.class, MemberCategory.DECLARED_FIELDS); - hints.reflection().registerType(JobContext.class, MemberCategory.INVOKE_PUBLIC_METHODS); - hints.reflection().registerType(StepContext.class, MemberCategory.INVOKE_PUBLIC_METHODS); - hints.reflection().registerType(JobParameter.class, MemberCategory.values()); - hints.reflection().registerType(JobParameters.class, MemberCategory.values()); - hints.reflection().registerType(ExitStatus.class, MemberCategory.values()); - hints.reflection().registerType(JobInstance.class, MemberCategory.values()); - hints.reflection().registerType(JobExecution.class, MemberCategory.values()); - hints.reflection().registerType(StepExecution.class, MemberCategory.values()); - hints.reflection().registerType(StepContribution.class, MemberCategory.values()); - hints.reflection().registerType(Entity.class, MemberCategory.values()); - hints.reflection().registerType(ExecutionContext.class, MemberCategory.values()); - hints.reflection().registerType(Chunk.class, MemberCategory.values()); + hints.reflection().registerType(Types.class); + hints.reflection().registerType(JobContext.class); + hints.reflection().registerType(StepContext.class); + hints.reflection().registerType(JobParameter.class); + hints.reflection().registerType(JobParameters.class); + hints.reflection().registerType(ExitStatus.class); + hints.reflection().registerType(JobInstance.class); + hints.reflection().registerType(JobExecution.class); + hints.reflection().registerType(StepExecution.class); + hints.reflection().registerType(StepContribution.class); + hints.reflection().registerType(Entity.class); + hints.reflection().registerType(ExecutionContext.class); + hints.reflection().registerType(Chunk.class); jdkTypes.stream() .map(TypeReference::of) .forEach(type -> hints.reflection().registerType(type, MemberCategory.values())); diff --git a/spring-batch-integration/src/main/java/org/springframework/batch/integration/aot/IntegrationRuntimeHints.java b/spring-batch-integration/src/main/java/org/springframework/batch/integration/aot/IntegrationRuntimeHints.java index 5f42caf800..a043f21a74 100644 --- a/spring-batch-integration/src/main/java/org/springframework/batch/integration/aot/IntegrationRuntimeHints.java +++ b/spring-batch-integration/src/main/java/org/springframework/batch/integration/aot/IntegrationRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the original author or authors. + * Copyright 2023-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package org.springframework.batch.integration.aot; -import org.springframework.aot.hint.MemberCategory; import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.batch.integration.chunk.ChunkRequest; @@ -28,6 +27,7 @@ * AOT hints for Spring Batch integration module. * * @author Mahmoud Ben Hassine + * @author Andrey Litvitski * @since 5.0.1 */ public class IntegrationRuntimeHints implements RuntimeHintsRegistrar { @@ -35,11 +35,10 @@ public class IntegrationRuntimeHints implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { // reflection hints - MemberCategory[] memberCategories = MemberCategory.values(); - hints.reflection().registerType(ChunkRequest.class, memberCategories); - hints.reflection().registerType(ChunkResponse.class, memberCategories); - hints.reflection().registerType(StepExecutionRequestHandler.class, memberCategories); - hints.reflection().registerType(MessageChannelPartitionHandler.class, memberCategories); + hints.reflection().registerType(ChunkRequest.class); + hints.reflection().registerType(ChunkResponse.class); + hints.reflection().registerType(StepExecutionRequestHandler.class); + hints.reflection().registerType(MessageChannelPartitionHandler.class); // serialization hints hints.serialization().registerType(ChunkRequest.class);