Update datasource configuration in samples/tests
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<property name="jobRegistry" ref="jobRegistry"/>
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</batch:step>
|
||||
</batch:job>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/batch https://www.springframework.org/schema/batch/spring-batch-2.2.xsd
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/batch https://www.springframework.org/schema/batch/spring-batch-2.2.xsd
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<bean id="partitioner" class="org.springframework.batch.core.partition.support.SimplePartitioner" />
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/batch https://www.springframework.org/schema/batch/spring-batch-2.2.xsd
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<beans:bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ConcurrentTaskExecutor" />
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<beans:bean id="reader" class="org.springframework.batch.core.configuration.xml.TestReader" />
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<beans:bean id="tasklet" class="org.springframework.batch.core.configuration.xml.TestTasklet" p:name="bar"/>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/batch https://www.springframework.org/schema/batch/spring-batch.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<property name="targetMethod" value="println"/>
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
<property name="targetMethod" value="println"/>
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
http://www.springframework.org/schema/batch https://www.springframework.org/schema/batch/spring-batch.xsd
|
||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
</decision>
|
||||
</job>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<property name="step" ref="step" />
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
<property name="step" ref="step" />
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<property name="step" ref="step" />
|
||||
</bean>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/jdbc https://www.springframework.org/schema/jdbc/spring-jdbc-3.2.xsd">
|
||||
|
||||
<jdbc:embedded-database id="dataSource" type="HSQL"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true" type="HSQL"/>
|
||||
|
||||
<jdbc:initialize-database data-source="dataSource">
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 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.
|
||||
@@ -17,6 +17,7 @@ package org.springframework.batch.sample.config;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
|
||||
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
@@ -30,9 +31,11 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@EnableBatchProcessing
|
||||
public class RetrySampleConfiguration {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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.remotechunking;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.apache.commons.dbcp2.BasicDataSource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
|
||||
/**
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@Configuration
|
||||
public class DataSourceConfiguration {
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
return new EmbeddedDatabaseBuilder()
|
||||
.addScript("/org/springframework/batch/core/schema-drop-hsqldb.sql")
|
||||
.addScript("/org/springframework/batch/core/schema-hsqldb.sql")
|
||||
.generateUniqueName(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.channel.QueueChannel;
|
||||
@@ -50,6 +51,7 @@ import org.springframework.integration.jms.dsl.Jms;
|
||||
@EnableBatchIntegration
|
||||
@EnableIntegration
|
||||
@PropertySource("classpath:remote-chunking.properties")
|
||||
@Import(DataSourceConfiguration.class)
|
||||
public class ManagerConfiguration {
|
||||
|
||||
@Value("${broker.url}")
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.integration.channel.DirectChannel;
|
||||
import org.springframework.integration.config.EnableIntegration;
|
||||
@@ -50,6 +51,7 @@ import org.springframework.integration.jms.dsl.Jms;
|
||||
@EnableBatchIntegration
|
||||
@EnableIntegration
|
||||
@PropertySource("classpath:remote-chunking.properties")
|
||||
@Import(DataSourceConfiguration.class)
|
||||
public class WorkerConfiguration {
|
||||
|
||||
@Value("${broker.url}")
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* http://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.skip;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
|
||||
@Configuration
|
||||
public class DataSourceConfiguration {
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
return new EmbeddedDatabaseBuilder()
|
||||
.addScript("/org/springframework/batch/core/schema-drop-hsqldb.sql")
|
||||
.addScript("/org/springframework/batch/core/schema-hsqldb.sql")
|
||||
.generateUniqueName(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 the original author or authors.
|
||||
* Copyright 2019-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,6 +18,8 @@ package org.springframework.batch.sample.skip;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
@@ -29,12 +31,15 @@ import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.support.ListItemReader;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
|
||||
/**
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@Configuration
|
||||
@EnableBatchProcessing
|
||||
@Import(DataSourceConfiguration.class)
|
||||
public class SkippableExceptionDuringProcessSample {
|
||||
|
||||
private final JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 the original author or authors.
|
||||
* Copyright 2019-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.
|
||||
@@ -29,12 +29,14 @@ import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.support.ListItemReader;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@Configuration
|
||||
@EnableBatchProcessing
|
||||
@Import(DataSourceConfiguration.class)
|
||||
public class SkippableExceptionDuringReadSample {
|
||||
|
||||
private final JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 the original author or authors.
|
||||
* Copyright 2019-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.
|
||||
@@ -29,12 +29,14 @@ import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.batch.item.support.ListItemReader;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
/**
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@Configuration
|
||||
@EnableBatchProcessing
|
||||
@Import(DataSourceConfiguration.class)
|
||||
public class SkippableExceptionDuringWriteSample {
|
||||
|
||||
private final JobBuilderFactory jobBuilderFactory;
|
||||
|
||||
@@ -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.
|
||||
@@ -18,6 +18,8 @@ package org.springframework.batch.sample.validation;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
||||
@@ -30,6 +32,7 @@ import org.springframework.batch.sample.validation.domain.Person;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
|
||||
/**
|
||||
* @author Mahmoud Ben Hassine
|
||||
@@ -82,4 +85,13 @@ public class ValidationSampleConfiguration {
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
return new EmbeddedDatabaseBuilder()
|
||||
.addScript("/org/springframework/batch/core/schema-drop-hsqldb.sql")
|
||||
.addScript("/org/springframework/batch/core/schema-hsqldb.sql")
|
||||
.generateUniqueName(true)
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 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.
|
||||
@@ -22,10 +22,10 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
@EnableBatchProcessing
|
||||
public class JobRunnerConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019-2020 the original author or authors.
|
||||
* Copyright 2019-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.
|
||||
@@ -23,6 +23,8 @@ import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import io.micrometer.core.instrument.Meter;
|
||||
import io.micrometer.core.instrument.Metrics;
|
||||
import org.junit.Test;
|
||||
@@ -43,6 +45,8 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
@@ -277,6 +281,7 @@ public class BatchMetricsTests {
|
||||
|
||||
@Configuration
|
||||
@EnableBatchProcessing
|
||||
@Import(DataSoourceConfiguration.class)
|
||||
static class MyJobConfiguration {
|
||||
|
||||
private JobBuilderFactory jobBuilderFactory;
|
||||
@@ -324,4 +329,16 @@ public class BatchMetricsTests {
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@Configuration
|
||||
static class DataSoourceConfiguration {
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
return new EmbeddedDatabaseBuilder()
|
||||
.addScript("/org/springframework/batch/core/schema-drop-hsqldb.sql")
|
||||
.addScript("/org/springframework/batch/core/schema-hsqldb.sql")
|
||||
.generateUniqueName(true)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<batch:job-repository id="jobRepository" table-prefix="BATCH_"/>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
<batch:job-repository id="jobRepository" table-prefix="BATCH_"/>
|
||||
|
||||
<jdbc:embedded-database id="dataSource"/>
|
||||
<jdbc:embedded-database id="dataSource" generate-name="true"/>
|
||||
|
||||
<jdbc:initialize-database>
|
||||
<jdbc:script location="classpath:/org/springframework/batch/core/schema-drop-hsqldb.sql"/>
|
||||
|
||||
Reference in New Issue
Block a user