diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBeanRuntimeHints.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBeanRuntimeHints.java index 3887667ae3a..ee5e43c05c3 100644 --- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBeanRuntimeHints.java +++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBeanRuntimeHints.java @@ -27,7 +27,7 @@ import org.springframework.util.ClassUtils; /** * {@link RuntimeHintsRegistrar} implementation that makes sure {@link SchedulerFactoryBean} - * reflection entries are registered. + * reflection hints are registered. * * @author Sebastien Deleuze * @author Stephane Nicoll diff --git a/spring-core/src/main/java/org/springframework/aot/hint/annotation/RegisterReflectionForBinding.java b/spring-core/src/main/java/org/springframework/aot/hint/annotation/RegisterReflectionForBinding.java index 0f027782a5a..6062af631e0 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/annotation/RegisterReflectionForBinding.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/annotation/RegisterReflectionForBinding.java @@ -77,8 +77,7 @@ public @interface RegisterReflectionForBinding { /** * Classes for which reflection hints should be registered. - *

At least one class must be specified either via {@link #value} or - * {@code #classes}. + *

At least one class must be specified either via {@link #value} or {@code classes}. * @see #value() */ @AliasFor("value") diff --git a/spring-core/src/main/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHints.java b/spring-core/src/main/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHints.java index a25287e1988..8081223c521 100644 --- a/spring-core/src/main/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHints.java +++ b/spring-core/src/main/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -48,8 +48,8 @@ class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { - ClassLoader classLoaderToUse = (classLoader != null ? classLoader - : SpringFactoriesLoaderRuntimeHints.class.getClassLoader()); + ClassLoader classLoaderToUse = (classLoader != null ? classLoader : + SpringFactoriesLoaderRuntimeHints.class.getClassLoader()); for (String resourceLocation : RESOURCE_LOCATIONS) { registerHints(hints, classLoaderToUse, resourceLocation); } @@ -65,6 +65,7 @@ class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar { private void registerHints(RuntimeHints hints, ClassLoader classLoader, String factoryClassName, List implementationClassNames) { + Class factoryClass = resolveClassName(classLoader, factoryClassName); if (factoryClass == null) { if (logger.isTraceEnabled()) { @@ -102,6 +103,7 @@ class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar { } } + private static class ExtendedSpringFactoriesLoader extends SpringFactoriesLoader { ExtendedSpringFactoriesLoader(@Nullable ClassLoader classLoader, Map> factories) { @@ -111,7 +113,6 @@ class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar { static Map> accessLoadFactoriesResource(ClassLoader classLoader, String resourceLocation) { return SpringFactoriesLoader.loadFactoriesResource(classLoader, resourceLocation); } - } } diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactoryRuntimeHints.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactoryRuntimeHints.java index f78c97c746a..9f44861ed8d 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactoryRuntimeHints.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseFactoryRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 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. @@ -24,9 +24,9 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.lang.Nullable; /** - * {@link RuntimeHintsRegistrar} implementation that registers reflection hints for - * {@code EmbeddedDataSourceProxy#shutdown} in order to allow it to be used as a bean - * destroy method. + * {@link RuntimeHintsRegistrar} implementation that registers reflection hints + * for {@code EmbeddedDataSourceProxy#shutdown} in order to allow it to be used + * as a bean destroy method. * * @author Sebastien Deleuze * @since 6.0 diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerRuntimeHints.java b/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerRuntimeHints.java index ad68ac63f9b..72891dffdc0 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerRuntimeHints.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/EntityManagerRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -42,6 +42,7 @@ class EntityManagerRuntimeHints implements RuntimeHintsRegistrar { private static final String NATIVE_QUERY_IMPL_CLASS_NAME = "org.hibernate.query.sql.internal.NativeQueryImpl"; + @Override public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { if (ClassUtils.isPresent(HIBERNATE_SESSION_FACTORY_CLASS_NAME, classLoader)) { @@ -71,4 +72,5 @@ class EntityManagerRuntimeHints implements RuntimeHintsRegistrar { catch (ClassNotFoundException ignored) { } } + } diff --git a/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionRuntimeHints.java b/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionRuntimeHints.java index 60dc32eb734..8343868b490 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionRuntimeHints.java +++ b/spring-tx/src/main/java/org/springframework/transaction/annotation/TransactionRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -24,8 +24,8 @@ import org.springframework.aot.hint.TypeReference; import org.springframework.lang.Nullable; /** - * {@link RuntimeHintsRegistrar} implementation that registers runtime hints for - * transaction management. + * {@link RuntimeHintsRegistrar} implementation that registers runtime hints + * for transaction management. * * @author Sebastien Deleuze * @since 6.0 @@ -35,7 +35,8 @@ class TransactionRuntimeHints implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { - hints.reflection().registerTypes(TypeReference.listOf(Isolation.class, Propagation.class), + hints.reflection().registerTypes( + TypeReference.listOf(Isolation.class, Propagation.class), TypeHint.builtWith(MemberCategory.DECLARED_FIELDS)); } diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/JacksonModulesRuntimeHints.java b/spring-web/src/main/java/org/springframework/http/converter/json/JacksonModulesRuntimeHints.java index 2c41e5165bd..f7f07a9a7f6 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/JacksonModulesRuntimeHints.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/JacksonModulesRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 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. @@ -25,7 +25,7 @@ import org.springframework.aot.hint.TypeHint.Builder; import org.springframework.lang.Nullable; /** - * {@link RuntimeHintsRegistrar} implementation that registers reflection entries + * {@link RuntimeHintsRegistrar} implementation that registers reflection hints * for {@link Jackson2ObjectMapperBuilder} well-known modules. * * @author Sebastien Deleuze diff --git a/spring-web/src/main/java/org/springframework/http/converter/json/ProblemDetailRuntimeHints.java b/spring-web/src/main/java/org/springframework/http/converter/json/ProblemDetailRuntimeHints.java index 8d4ef0a39aa..d04fda433f0 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/json/ProblemDetailRuntimeHints.java +++ b/spring-web/src/main/java/org/springframework/http/converter/json/ProblemDetailRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -24,7 +24,7 @@ import org.springframework.lang.Nullable; import org.springframework.util.ClassUtils; /** - * {@link RuntimeHintsRegistrar} implementation that registers binding reflection entries + * {@link RuntimeHintsRegistrar} implementation that registers binding reflection hints * for {@link ProblemDetail} serialization support with Jackson. * * @author Brian Clozel diff --git a/spring-web/src/main/java/org/springframework/web/util/WebUtilRuntimeHints.java b/spring-web/src/main/java/org/springframework/web/util/WebUtilRuntimeHints.java index 6c9213ae045..dfff61eea9c 100644 --- a/spring-web/src/main/java/org/springframework/web/util/WebUtilRuntimeHints.java +++ b/spring-web/src/main/java/org/springframework/web/util/WebUtilRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 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. @@ -22,8 +22,8 @@ import org.springframework.core.io.ClassPathResource; import org.springframework.lang.Nullable; /** - * {@link RuntimeHintsRegistrar} implementation that registers resource - * hints for web util resources. + * {@link RuntimeHintsRegistrar} implementation that registers resource hints + * for resources in the {@code web.util} package. * * @author Sebastien Deleuze * @since 6.0 diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketServiceRuntimeHints.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketServiceRuntimeHints.java index 83d29fe105f..d931aa3ea26 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketServiceRuntimeHints.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/support/HandshakeWebSocketServiceRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2024 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. @@ -22,8 +22,8 @@ import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.lang.Nullable; /** - * {@link RuntimeHintsRegistrar} implementation that registers reflection hints related to - * {@link HandshakeWebSocketService}. + * {@link RuntimeHintsRegistrar} implementation that registers reflection hints + * related to {@link HandshakeWebSocketService}. * * @author Sebastien Deleuze * @since 6.0 @@ -35,4 +35,5 @@ class HandshakeWebSocketServiceRuntimeHints implements RuntimeHintsRegistrar { hints.reflection().registerType(HandshakeWebSocketService.initUpgradeStrategy().getClass(), MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); } + } diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/server/support/HandshakeHandlerRuntimeHints.java b/spring-websocket/src/main/java/org/springframework/web/socket/server/support/HandshakeHandlerRuntimeHints.java index 6998234705c..46a513377f7 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/server/support/HandshakeHandlerRuntimeHints.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/server/support/HandshakeHandlerRuntimeHints.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -25,7 +25,7 @@ import org.springframework.lang.Nullable; import org.springframework.util.ClassUtils; /** - * {@link RuntimeHintsRegistrar} implementation that registers reflection entries + * {@link RuntimeHintsRegistrar} implementation that registers reflection hints * for {@link AbstractHandshakeHandler}. * * @author Sebastien Deleuze @@ -61,6 +61,7 @@ class HandshakeHandlerRuntimeHints implements RuntimeHintsRegistrar { "com.ibm.websphere.wsoc.WsWsocServerContainer", classLoader); } + @Override public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) { ReflectionHints reflectionHints = hints.reflection(); @@ -88,4 +89,5 @@ class HandshakeHandlerRuntimeHints implements RuntimeHintsRegistrar { reflectionHints.registerType(TypeReference.of(className), builder -> builder.withMembers(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS)); } + }