Polishing

This commit is contained in:
Juergen Hoeller 2024-05-07 15:52:13 +02:00
parent 05d9b52b19
commit 4f02be263f
11 changed files with 34 additions and 28 deletions

View File

@ -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

View File

@ -77,8 +77,7 @@ public @interface RegisterReflectionForBinding {
/**
* Classes for which reflection hints should be registered.
* <p>At least one class must be specified either via {@link #value} or
* {@code #classes}.
* <p>At least one class must be specified either via {@link #value} or {@code classes}.
* @see #value()
*/
@AliasFor("value")

View File

@ -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<String> 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<String, List<String>> factories) {
@ -111,7 +113,6 @@ class SpringFactoriesLoaderRuntimeHints implements RuntimeHintsRegistrar {
static Map<String, List<String>> accessLoadFactoriesResource(ClassLoader classLoader, String resourceLocation) {
return SpringFactoriesLoader.loadFactoriesResource(classLoader, resourceLocation);
}
}
}

View File

@ -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

View File

@ -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) {
}
}
}

View File

@ -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));
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);
}
}

View File

@ -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));
}
}