Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any plans for Java 9 Jigsaw (module) of Spring projects?

Java 9 is scheduled to be released soon (July 27). Are there any plans to release a Java 9 compliant version of Spring projects that will be modular (Java 9 project Jigsaw)?

like image 369
user3646774 Avatar asked Apr 28 '17 16:04

user3646774


People also ask

Which is correct about module system in Java 9?

Java Module System is a major change in Java 9 version. Java added this feature to collect Java packages and code into a single unit called module. In earlier versions of Java, there was no concept of module to create modular Java applications, that why size of application increased and difficult to move around.

What are modules in Java 9?

Defining the Java 9 module. A module is a collection of code, data, and resources. It is a set of related packages and types (classes, abstract classes, interfaces, and more) with code, data files, and some static resources.

Does spring use Java modules?

As of Spring Framework 5.1, Spring requires JDK 8+ (Java SE 8+) and provides out-of-the-box support for JDK 11 LTS.

How many module layers are there in spring?

The Spring Framework consists of features organized into about 20 modules. These modules are grouped into Core Container, Data Access/Integration, Web, AOP (Aspect Oriented Programming), Instrumentation, and Test, as shown in the following diagram.

What is Jigsaw project in Java?

Project Jigsaw is an umbrella project with the new features aimed at two aspects: the introduction of module system in the Java language and its implementation in JDK source and Java runtime In this article, we'll introduce you to the Jigsaw project and its features and finally wrap it up with a simple modular application.

What is the Java module system?

The Java Module System is a feature that was released with Java 9 and was part of the project Jigsaw. The reason for having the the Java Module System is to offer a greater level of granularity in terms of class visibility. As a result, this allows a better separation of concerns.

Is there a new modular system planned for Java?

With all these limitations, when using JAR as the unit of modularity, the Java language creators came up with a new construct in the language called modules. And with this, there is a whole new modular system planned for Java. 3. Project Jigsaw The primary motivations for this project are:


2 Answers

Spring 5, the next major version of Spring, won't be modular. However you can use Spring 5 jars/artifacts as automatic modules in your module-info files. See official blogpost and What's new annoucement.

like image 128
bbelovic Avatar answered Oct 25 '22 13:10

bbelovic


Conserning module-info.java see Declare Spring modules with JDK 9 module metadata issue last commit:

This issue is marked as "General Backlog", indicating that we won't deal with it for 5.1 (otherwise it'd be marked for 5.1 GA still) and probably not in subsequent 5.x releases either (otherwise it'd be marked as "5.x Backlog").

Specifically, we can't ship module-info files quite yet since we'd need stable module names for all of our optional dependencies... and many of those don't declare stable module names at this point (that is, they don't even include an Automatic-Module-Name manifest entry in their jar). Also, we'd need to build the entire framework on JDK 9+ for the compiler to understand the module-info.java format which is not entirely trivial either, even if the framework itself is known to work fine with JDK 9/10/11 at runtime.

All in all, my prediction about module-info files for 5.1 turned out to be too ambitious. Our current focus is on general JDK 11 compatibility (SPR-16391) on the classpath and as automatic modules on the module path, as well as GraalVM compatibility (SPR-16991). The use of jlink requires manual addition of module-info.class files to the framework jars for the time being... which might stay that way for several years still until we ship a JDK 11 baselined Spring Framework 6.0 against a new generation of dependencies.

like image 26
Grigory Kislin Avatar answered Oct 25 '22 12:10

Grigory Kislin