与 Java 11 兼容的最小 Spring-batch 和 spring-context 版本?

Minimum Spring-batch and spring-context version compatible with Java 11?

我需要将我的 maven 项目升级到 Java 11,所以我想知道:

  1. Java 11 支持的 Spring Frameworkspring-batch version 的最低版本是多少?
  2. 要在 pom 中更改什么?

目前我知道:

  1. 我的项目不是 spring-boot。
  2. 我知道 Spring version 至少应该是 5.1
  3. <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.8.1</version>-->
    <configuration>
         <release>11</release>-->
         <encoding>iso-8859-1</encoding>
    </configuration>
    

pom 包含以下内容:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>jo.tatova.honki</groupId>
<artifactId>toko</artifactId>
<version>1.0.40-SNAPSHOT</version>

<packaging>jar</packaging>
<name>toko</name>

<parent>
    <groupId>jo.tatova.parent</groupId>
    <artifactId>parent-pom</artifactId>
    <version>1.0.0</version>
</parent>

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>

    <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
    <org.springframework.batch>2.1.9.RELEASE</org.springframework.batch>
    <org.slf4j-version>1.6.2</org.slf4j-version>
</properties>

<dependencies>
    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework-version}</version>
        <exclusions>
            <!-- Exclude Commons Logging in favor of SLF4j -->
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.batch</groupId>
        <artifactId>spring-batch-core</artifactId>
        <version>${org.springframework.batch}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>3.6.10.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>3.6.10.Final</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.2.0.Final</version>
    </dependency>

    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.4</version>
    </dependency>

    <dependency>
        <groupId>jo.tatova</groupId>
        <artifactId>record-utils</artifactId>
        <version>1.0</version>
    </dependency>

    <dependency>
        <groupId>jo.tatova.honki</groupId>
        <artifactId>honki-java</artifactId>
        <version>1.0.110-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>commons-cli</groupId>
        <artifactId>commons-cli</artifactId>
        <version>1.2</version>
    </dependency>

    <!-- Logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>com.informix</groupId>
        <artifactId>informix-driver</artifactId>
        <version>3.0</version>
        <scope>runtime</scope>
    </dependency>

    <!-- Test -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <encoding>iso-8859-1</encoding>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.1</version>
            <configuration>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <shadedClassifierName>jar-with-dependencies</shadedClassifierName>
                <filters>
                    <filter>
                        <artifact>*:*</artifact>
                        <excludes>
                            <exclude>META-INF/*.SF</exclude>
                            <exclude>META-INF/*.DSA</exclude>
                            <exclude>META-INF/*.RSA</exclude>
                            <exclude>META-INF/LICENSE*</exclude>
                            <exclude>META-INF/license.txt</exclude>
                            <exclude>META-INF/NOTICE*</exclude>
                            <exclude>META-INF/notice.txt</exclude>
                            <exclude>LICENSE</exclude>
                            <exclude>license.txt</exclude>
                            <exclude>NOTICE</exclude>
                            <exclude>overview.html</exclude>
                            <exclude>readme.txt</exclude>
                            <exclude>testpool.jocl</exclude>
                            <exclude>XPP3_1.1.4c_MIN_VERSION</exclude>
                        </excludes>
                    </filter>
                </filters>
                <transformers>
                    <transformer
                            implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                        <resource>META-INF/spring.handlers</resource>
                    </transformer>
                    <transformer
                            implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                        <resource>META-INF/spring.schemas</resource>
                    </transformer>
                    <transformer
                            implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <manifestEntries>
                            <Main-Class>jo.tatova.honki.toko.TokoParser</Main-Class>
                        </manifestEntries>
                    </transformer>
                </transformers>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

I know the Spring version should be at least 5.1

<org.springframework.batch>2.1.9.RELEASE</org.springframework.batch>

您似乎正在从 v2 升级 Spring 批处理。由于你的Spring版本应该至少是v5.1,你需要升级Spring Batch到v4(基于Spring Framework v5)并且需要Java 8最低限度。因此,关于最低 Java 版本的问题的答案是 Java 8,但如果需要,您应该可以使用 Java 11。