Upgrade dependencies to major versions for Spring Batch 5
* Upgrade to Jakarta EE 9 * Upgrade to Spring Framework 6 * Upgrade to Spring Integration 6 * Upgrade to Spring Data 3 * Upgrade to Spring AMQP 3 * Upgrade to Spring for Apache Kafka 3 LDIF support is still in progress waiting for the next major version of Spring LDAP. Closes #4027 Closes #3656
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2021 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.batch.sample.config;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
@@ -31,6 +31,7 @@ import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2010 the original author or authors.
|
||||
* Copyright 2006-2021 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.
|
||||
@@ -20,7 +20,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import jakarta.mail.MessagingException;
|
||||
|
||||
import org.springframework.mail.MailException;
|
||||
import org.springframework.mail.MailSendException;
|
||||
@@ -30,6 +30,7 @@ import org.springframework.mail.SimpleMailMessage;
|
||||
/**
|
||||
* @author Dan Garrette
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
* @since 2.1
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2014 the original author or authors.
|
||||
* Copyright 2006-2021 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,10 +24,11 @@ import org.springframework.batch.sample.domain.order.Address;
|
||||
/**
|
||||
* Custom class that contains logic that would normally be be contained in
|
||||
* {@link org.springframework.batch.item.ItemReader} and
|
||||
* {@link javax.batch.api.chunk.ItemWriter}.
|
||||
* {@link jakarta.batch.api.chunk.ItemWriter}.
|
||||
*
|
||||
* @author tomas.slanina
|
||||
* @author Robert Kasanicky
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class PersonService {
|
||||
private static final int GENERATION_LIMIT = 10;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2021 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.
|
||||
@@ -18,9 +18,9 @@ package org.springframework.batch.sample.domain.trade;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "CUSTOMER")
|
||||
|
||||
@@ -18,13 +18,13 @@ package org.springframework.batch.sample.jsr352;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import javax.batch.api.AbstractBatchlet;
|
||||
import javax.batch.api.BatchProperty;
|
||||
import javax.inject.Inject;
|
||||
import jakarta.batch.api.AbstractBatchlet;
|
||||
import jakarta.batch.api.BatchProperty;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Sample {@link javax.batch.api.Batchlet} implementation.
|
||||
* Sample {@link jakarta.batch.api.Batchlet} implementation.
|
||||
* </p>
|
||||
*
|
||||
* @since 3.0
|
||||
|
||||
@@ -18,11 +18,11 @@ package org.springframework.batch.sample.jsr352;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import javax.batch.api.chunk.ItemProcessor;
|
||||
import jakarta.batch.api.chunk.ItemProcessor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Sample {@link javax.batch.api.chunk.ItemProcessor} implementation.
|
||||
* Sample {@link jakarta.batch.api.chunk.ItemProcessor} implementation.
|
||||
* </p>
|
||||
*
|
||||
* @since 3.0
|
||||
|
||||
@@ -17,14 +17,14 @@ package org.springframework.batch.sample.jsr352;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.batch.api.chunk.AbstractItemReader;
|
||||
import jakarta.batch.api.chunk.AbstractItemReader;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Sample {@link javax.batch.api.chunk.ItemReader} implementation.
|
||||
* Sample {@link jakarta.batch.api.chunk.ItemReader} implementation.
|
||||
* </p>
|
||||
*
|
||||
* @since 3.0
|
||||
|
||||
@@ -18,12 +18,12 @@ package org.springframework.batch.sample.jsr352;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import javax.batch.api.chunk.AbstractItemWriter;
|
||||
import jakarta.batch.api.chunk.AbstractItemWriter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Sample {@link javax.batch.api.chunk.ItemWriter} implementation.
|
||||
* Sample {@link jakarta.batch.api.chunk.ItemWriter} implementation.
|
||||
* </p>
|
||||
*
|
||||
* @since 3.0
|
||||
|
||||
@@ -23,8 +23,8 @@ import org.springframework.batch.core.step.tasklet.Tasklet;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import javax.batch.api.BatchProperty;
|
||||
import javax.inject.Inject;
|
||||
import jakarta.batch.api.BatchProperty;
|
||||
import jakarta.inject.Inject;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -1,8 +1,23 @@
|
||||
/*
|
||||
* Copyright 2021 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.sample.metrics;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.annotation.PostConstruct;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
import io.micrometer.core.instrument.Metrics;
|
||||
import io.micrometer.prometheus.PrometheusConfig;
|
||||
|
||||
@@ -17,7 +17,8 @@ package org.springframework.batch.sample.remotechunking;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import jakarta.jms.JMSException;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
@@ -64,10 +65,9 @@ public class ManagerConfiguration {
|
||||
private RemoteChunkingManagerStepBuilderFactory managerStepBuilderFactory;
|
||||
|
||||
@Bean
|
||||
public ActiveMQConnectionFactory connectionFactory() {
|
||||
public ActiveMQConnectionFactory connectionFactory() throws JMSException {
|
||||
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
|
||||
connectionFactory.setBrokerURL(this.brokerUrl);
|
||||
connectionFactory.setTrustAllPackages(true);
|
||||
return connectionFactory;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
*/
|
||||
package org.springframework.batch.sample.remotechunking;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import jakarta.jms.JMSException;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.integration.chunk.RemoteChunkingWorkerBuilder;
|
||||
@@ -61,10 +62,9 @@ public class WorkerConfiguration {
|
||||
private RemoteChunkingWorkerBuilder<Integer, Integer> remoteChunkingWorkerBuilder;
|
||||
|
||||
@Bean
|
||||
public ActiveMQConnectionFactory connectionFactory() {
|
||||
public ActiveMQConnectionFactory connectionFactory() throws JMSException {
|
||||
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
|
||||
connectionFactory.setBrokerURL(this.brokerUrl);
|
||||
connectionFactory.setTrustAllPackages(true);
|
||||
return connectionFactory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2018-2021 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.
|
||||
@@ -16,7 +16,8 @@
|
||||
|
||||
package org.springframework.batch.sample.remotepartitioning;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import jakarta.jms.JMSException;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -34,10 +35,9 @@ public class BrokerConfiguration {
|
||||
private String brokerUrl;
|
||||
|
||||
@Bean
|
||||
public ActiveMQConnectionFactory connectionFactory() {
|
||||
public ActiveMQConnectionFactory connectionFactory() throws JMSException {
|
||||
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
|
||||
connectionFactory.setBrokerURL(this.brokerUrl);
|
||||
connectionFactory.setTrustAllPackages(true);
|
||||
return connectionFactory;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018-2019 the original author or authors.
|
||||
* Copyright 2018-2021 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.batch.sample.remotepartitioning.aggregating;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.Step;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018-2019 the original author or authors.
|
||||
* Copyright 2018-2021 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.batch.sample.remotepartitioning.aggregating;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018-2019 the original author or authors.
|
||||
* Copyright 2018-2021 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.batch.sample.remotepartitioning.polling;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.Step;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.batch.sample.remotepartitioning.polling;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
* Copyright 2018-2021 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.
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.batch.sample.validation.domain;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* @author Mahmoud Ben Hassine
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2018-2019 the original author or authors.
|
||||
* Copyright 2018-2021 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.
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
package org.springframework.batch.sample;
|
||||
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
|
||||
import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
|
||||
import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
@@ -48,22 +51,23 @@ public class RemoteChunkingJobFunctionalTests {
|
||||
|
||||
private static final String BROKER_DATA_DIRECTORY = "target/activemq-data";
|
||||
|
||||
@Value("${broker.url}")
|
||||
private String brokerUrl;
|
||||
|
||||
@Autowired
|
||||
private JobLauncherTestUtils jobLauncherTestUtils;
|
||||
|
||||
private BrokerService brokerService;
|
||||
private static EmbeddedActiveMQ brokerService;
|
||||
|
||||
private AnnotationConfigApplicationContext workerApplicationContext;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
this.brokerService = new BrokerService();
|
||||
this.brokerService.addConnector(this.brokerUrl);
|
||||
this.brokerService.setDataDirectory(BROKER_DATA_DIRECTORY);
|
||||
this.brokerService.start();
|
||||
Configuration configuration =
|
||||
new ConfigurationImpl()
|
||||
.addAcceptorConfiguration("jms", "tcp://localhost:61616")
|
||||
.setPersistenceEnabled(false)
|
||||
.setSecurityEnabled(false)
|
||||
.setJMXManagementEnabled(false)
|
||||
.setJournalDatasync(false);
|
||||
this.brokerService = new EmbeddedActiveMQ().setConfiguration(configuration).start();
|
||||
this.workerApplicationContext = new AnnotationConfigApplicationContext(WorkerConfiguration.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,9 @@ package org.springframework.batch.sample;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.activemq.broker.BrokerService;
|
||||
import org.apache.activemq.artemis.core.config.Configuration;
|
||||
import org.apache.activemq.artemis.core.config.impl.ConfigurationImpl;
|
||||
import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ;
|
||||
import org.junit.After;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
@@ -55,7 +57,7 @@ public abstract class RemotePartitioningJobFunctionalTests {
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
|
||||
private BrokerService brokerService;
|
||||
private EmbeddedActiveMQ brokerService;
|
||||
|
||||
private AnnotationConfigApplicationContext workerApplicationContext;
|
||||
|
||||
@@ -63,10 +65,14 @@ public abstract class RemotePartitioningJobFunctionalTests {
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
this.brokerService = new BrokerService();
|
||||
this.brokerService.addConnector(this.brokerUrl);
|
||||
this.brokerService.setDataDirectory(BROKER_DATA_DIRECTORY);
|
||||
this.brokerService.start();
|
||||
Configuration configuration =
|
||||
new ConfigurationImpl()
|
||||
.addAcceptorConfiguration("jms", "tcp://localhost:61617")
|
||||
.setPersistenceEnabled(false)
|
||||
.setSecurityEnabled(false)
|
||||
.setJMXManagementEnabled(false)
|
||||
.setJournalDatasync(false);
|
||||
this.brokerService = new EmbeddedActiveMQ().setConfiguration(configuration).start();
|
||||
ResourceDatabasePopulator databasePopulator = new ResourceDatabasePopulator();
|
||||
databasePopulator.addScript(new ClassPathResource("/org/springframework/batch/core/schema-drop-hsqldb.sql"));
|
||||
databasePopulator.addScript(new ClassPathResource("/org/springframework/batch/core/schema-hsqldb.sql"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2021 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.
|
||||
@@ -18,10 +18,10 @@ package org.springframework.batch.sample.jsr352;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.batch.operations.JobOperator;
|
||||
import javax.batch.runtime.BatchRuntime;
|
||||
import javax.batch.runtime.BatchStatus;
|
||||
import javax.batch.runtime.JobExecution;
|
||||
import jakarta.batch.operations.JobOperator;
|
||||
import jakarta.batch.runtime.BatchRuntime;
|
||||
import jakarta.batch.runtime.BatchStatus;
|
||||
import jakarta.batch.runtime.JobExecution;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
@@ -33,6 +33,7 @@ import static org.junit.Assert.assertTrue;
|
||||
*
|
||||
* @since 3.0
|
||||
* @author Chris Schaefer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class JsrConfigSampleTests {
|
||||
private Properties properties = new Properties();
|
||||
|
||||
Reference in New Issue
Block a user