Refer to the "Java Module System" instead of "Jigsaw"

This commit is contained in:
Sam Brannen 2024-08-22 13:00:39 +02:00
parent c5f51aab67
commit cac623b3f4
5 changed files with 26 additions and 24 deletions

View File

@ -317,8 +317,8 @@ exposed based on security policies in some environments -- for example, standalo
JDK 1.7.0_45 and higher (which requires 'Trusted-Library' setup in your manifests -- see
{stackoverflow-questions}/19394570/java-jre-7u45-breaks-classloader-getresources).
On JDK 9's module path (Jigsaw), Spring's classpath scanning generally works as expected.
However, make sure that your component classes are exported in your `module-info`
On the module path (Java Module System), Spring's classpath scanning generally works as
expected. However, make sure that your component classes are exported in your `module-info`
descriptors. If you expect Spring to invoke non-public members of your classes, make
sure that they are 'opened' (that is, that they use an `opens` declaration instead of an
`exports` declaration in your `module-info` descriptor).

View File

@ -905,8 +905,8 @@ policies in some environments -- for example, stand-alone applications on JDK 1.
and higher (which requires 'Trusted-Library' to be set up in your manifests. See
{stackoverflow-questions}/19394570/java-jre-7u45-breaks-classloader-getresources).
On JDK 9's module path (Jigsaw), Spring's classpath scanning generally works as expected.
Putting resources into a dedicated directory is highly recommendable here as well,
On the module path (Java Module System), Spring's classpath scanning generally works as
expected. Putting resources into a dedicated directory is highly recommendable here as well,
avoiding the aforementioned portability problems with searching the jar file root level.
====

View File

@ -37,12 +37,12 @@ support for different application architectures, including messaging, transactio
persistence, and web. It also includes the Servlet-based Spring MVC web framework and, in
parallel, the Spring WebFlux reactive web framework.
A note about modules: Spring's framework jars allow for deployment to JDK 9's module path
("Jigsaw"). For use in Jigsaw-enabled applications, the Spring Framework 5 jars come with
"Automatic-Module-Name" manifest entries which define stable language-level module names
("spring.core", "spring.context", etc.) independent from jar artifact names (the jars follow
the same naming pattern with "-" instead of ".", e.g. "spring-core" and "spring-context").
Of course, Spring's framework jars keep working fine on the classpath on both JDK 8 and 9+.
A note about modules: Spring Framework's jars allow for deployment to the module path (Java
Module System). For use in module-enabled applications, the Spring Framework jars come with
`Automatic-Module-Name` manifest entries which define stable language-level module names
(`spring.core`, `spring.context`, etc.) independent from jar artifact names. The jars follow
the same naming pattern with `-` instead of `.` for example, `spring-core` and `spring-context`.
Of course, Spring Framework's jars also work fine on the classpath.

View File

@ -243,12 +243,12 @@ public class ResourceBundleMessageSource extends AbstractResourceBasedMessageSou
return ResourceBundle.getBundle(basename, locale, classLoader, control);
}
catch (UnsupportedOperationException ex) {
// Probably in a Jigsaw environment on JDK 9+
// Probably in a Java Module System environment on JDK 9+
this.control = null;
String encoding = getDefaultEncoding();
if (encoding != null && logger.isInfoEnabled()) {
logger.info("ResourceBundleMessageSource is configured to read resources with encoding '" +
encoding + "' but ResourceBundle.Control not supported in current system environment: " +
encoding + "' but ResourceBundle.Control is not supported in current system environment: " +
ex.getMessage() + " - falling back to plain ResourceBundle.getBundle retrieval with the " +
"platform default encoding. Consider setting the 'defaultEncoding' property to 'null' " +
"for participating in the platform default and therefore avoiding this log message.");

View File

@ -332,10 +332,10 @@ public abstract class ClassUtils {
* @return a class instance for the supplied name
* @throws IllegalArgumentException if the class name was not resolvable
* (that is, the class could not be found or the class file could not be loaded)
* @throws IllegalStateException if the corresponding class is resolvable but
* there was a readability mismatch in the inheritance hierarchy of the class
* (typically a missing dependency declaration in a Jigsaw module definition
* for a superclass or interface implemented by the class to be loaded here)
* @throws IllegalStateException if the corresponding class is resolvable but there
* was a readability mismatch in the inheritance hierarchy of the class (typically a
* missing dependency declaration in a Java Module System module definition for a
* superclass or interface implemented by the class to be loaded here)
* @see #forName(String, ClassLoader)
*/
public static Class<?> resolveClassName(String className, @Nullable ClassLoader classLoader)
@ -365,10 +365,10 @@ public abstract class ClassUtils {
* (can be {@code null} which indicates the default class loader)
* @return whether the specified class is present (including all of its
* superclasses and interfaces)
* @throws IllegalStateException if the corresponding class is resolvable but
* there was a readability mismatch in the inheritance hierarchy of the class
* (typically a missing dependency declaration in a Jigsaw module definition
* for a superclass or interface implemented by the class to be checked here)
* @throws IllegalStateException if the corresponding class is resolvable but there
* was a readability mismatch in the inheritance hierarchy of the class (typically a
* missing dependency declaration in a Java Module System module definition for a
* superclass or interface implemented by the class to be checked here)
*/
public static boolean isPresent(String className, @Nullable ClassLoader classLoader) {
try {
@ -1388,8 +1388,9 @@ public abstract class ClassUtils {
/**
* Determine a corresponding interface method for the given method handle, if possible.
* <p>This is particularly useful for arriving at a public exported type on Jigsaw
* which can be reflectively invoked without an illegal access warning.
* <p>This is particularly useful for arriving at a public exported type on the Java
* Module System which allows the method to be invoked via reflection without an illegal
* access warning.
* @param method the method to be invoked, potentially from an implementation class
* @return the corresponding interface method, or the original method if none found
* @since 5.1
@ -1402,8 +1403,9 @@ public abstract class ClassUtils {
/**
* Determine a corresponding interface method for the given method handle, if possible.
* <p>This is particularly useful for arriving at a public exported type on Jigsaw
* which can be reflectively invoked without an illegal access warning.
* <p>This is particularly useful for arriving at a public exported type on the Java
* Module System which allows the method to be invoked via reflection without an illegal
* access warning.
* @param method the method to be invoked, potentially from an implementation class
* @param targetClass the target class to check for declared interfaces
* @return the corresponding interface method, or the original method if none found