Throw IllegalStateException from afterPropertiesSet
Consistently use Assert.state in the afterPropertiesSet() methods to throw IllegalStateException instead of IllegalArgumentException when some properties are missing and/or invalid. Resolves #2244
This commit is contained in:
committed by
Mahmoud Ben Hassine
parent
b9d6e26d61
commit
fc0ec01ff8
@@ -278,7 +278,7 @@ public class DefaultJobLoader implements JobLoader, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(jobRegistry, "Job registry could not be null.");
|
||||
Assert.state(jobRegistry != null, "Job registry could not be null.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public class JobRegistryBeanPostProcessor
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jobRegistry, "JobRegistry must not be null");
|
||||
Assert.state(jobRegistry != null, "JobRegistry must not be null");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.batch.core.job.flow.support.state.StepState;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Convenience factory for {@link SimpleFlow} instances for use in the XML namespace. It
|
||||
@@ -94,7 +95,7 @@ public class SimpleFlowFactoryBean implements FactoryBean<SimpleFlow>, Initializ
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.hasText(name, "The flow must have a name");
|
||||
Assert.state(StringUtils.hasText(name), "The flow must have a name");
|
||||
|
||||
if (flowType == null) {
|
||||
flowType = SimpleFlow.class;
|
||||
|
||||
@@ -153,7 +153,7 @@ public class JobExplorerFactoryBean extends AbstractJobExplorerFactoryBean imple
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
||||
Assert.notNull(dataSource, "DataSource must not be null.");
|
||||
Assert.state(dataSource != null, "DataSource must not be null.");
|
||||
|
||||
if (jdbcOperations == null) {
|
||||
jdbcOperations = new JdbcTemplate(dataSource);
|
||||
|
||||
@@ -128,7 +128,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware, In
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jobRepository, "JobRepository must be set");
|
||||
Assert.state(jobRepository != null, "JobRepository must be set");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2018 the original author or authors.
|
||||
* Copyright 2011-2022 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.
|
||||
@@ -60,8 +60,8 @@ public class CompositeJobParametersValidator implements JobParametersValidator,
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(validators, "The 'validators' may not be null");
|
||||
Assert.notEmpty(validators, "The 'validators' may not be empty");
|
||||
Assert.state(validators != null, "The 'validators' may not be null");
|
||||
Assert.state(!validators.isEmpty(), "The 'validators' may not be empty");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -110,10 +110,10 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jobLauncher, "JobLauncher must be provided");
|
||||
Assert.notNull(jobRegistry, "JobLocator must be provided");
|
||||
Assert.notNull(jobExplorer, "JobExplorer must be provided");
|
||||
Assert.notNull(jobRepository, "JobRepository must be provided");
|
||||
Assert.state(jobLauncher != null, "JobLauncher must be provided");
|
||||
Assert.state(jobRegistry != null, "JobLocator must be provided");
|
||||
Assert.state(jobExplorer != null, "JobExplorer must be provided");
|
||||
Assert.state(jobRepository != null, "JobRepository must be provided");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -196,7 +196,7 @@ public abstract class AbstractListenerFactoryBean<T> implements FactoryBean<Obje
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(delegate, "Delegate must not be null");
|
||||
Assert.state(delegate != null, "Delegate must not be null");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -25,6 +25,7 @@ import org.springframework.batch.support.PatternMatcher;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* This class can be used to automatically promote items from the {@link Step}
|
||||
@@ -77,10 +78,10 @@ public class ExecutionContextPromotionListener implements StepExecutionListener,
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(this.keys, "The 'keys' property must be provided");
|
||||
Assert.notEmpty(this.keys, "The 'keys' property must not be empty");
|
||||
Assert.notNull(this.statuses, "The 'statuses' property must be provided");
|
||||
Assert.notEmpty(this.statuses, "The 'statuses' property must not be empty");
|
||||
Assert.state(this.keys != null, "The 'keys' property must be provided");
|
||||
Assert.state(!ObjectUtils.isEmpty(this.keys), "The 'keys' property must not be empty");
|
||||
Assert.state(this.statuses != null, "The 'statuses' property must be provided");
|
||||
Assert.state(!ObjectUtils.isEmpty(this.statuses), "The 'statuses' property must not be empty");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -78,8 +78,8 @@ public class PartitionStep extends AbstractStep {
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(stepExecutionSplitter, "StepExecutionSplitter must be provided");
|
||||
Assert.notNull(partitionHandler, "PartitionHandler must be provided");
|
||||
Assert.state(stepExecutionSplitter != null, "StepExecutionSplitter must be provided");
|
||||
Assert.state(partitionHandler != null, "PartitionHandler must be provided");
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -79,7 +79,7 @@ public abstract class AbstractJdbcBatchMetadataDao implements InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jdbcTemplate, "JdbcOperations is required");
|
||||
Assert.state(jdbcTemplate != null, "JdbcOperations is required");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(jobExecutionIncrementer, "The jobExecutionIncrementer must not be null.");
|
||||
Assert.state(jobExecutionIncrementer != null, "The jobExecutionIncrementer must not be null.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -311,7 +311,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(jobInstanceIncrementer, "jobInstanceIncrementer is required");
|
||||
Assert.state(jobInstanceIncrementer != null, "jobInstanceIncrementer is required");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -129,7 +129,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(stepExecutionIncrementer, "StepExecutionIncrementer cannot be null.");
|
||||
Assert.state(stepExecutionIncrementer != null, "StepExecutionIncrementer cannot be null.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -178,7 +178,7 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean<Jo
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(transactionManager, "TransactionManager must not be null.");
|
||||
Assert.state(transactionManager != null, "TransactionManager must not be null.");
|
||||
if (this.transactionAttributeSource == null) {
|
||||
Properties transactionAttributes = new Properties();
|
||||
transactionAttributes.setProperty("create*",
|
||||
|
||||
@@ -199,7 +199,7 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean i
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
||||
Assert.notNull(dataSource, "DataSource must not be null.");
|
||||
Assert.state(dataSource != null, "DataSource must not be null.");
|
||||
|
||||
if (jdbcOperations == null) {
|
||||
jdbcOperations = new JdbcTemplate(dataSource);
|
||||
@@ -226,12 +226,12 @@ public class JobRepositoryFactoryBean extends AbstractJobRepositoryFactoryBean i
|
||||
serializer = defaultSerializer;
|
||||
}
|
||||
|
||||
Assert.isTrue(incrementerFactory.isSupportedIncrementerType(databaseType),
|
||||
Assert.state(incrementerFactory.isSupportedIncrementerType(databaseType),
|
||||
() -> "'" + databaseType + "' is an unsupported database type. The supported database types are "
|
||||
+ StringUtils.arrayToCommaDelimitedString(incrementerFactory.getSupportedIncrementerTypes()));
|
||||
|
||||
if (clobType != null) {
|
||||
Assert.isTrue(isValidTypes(clobType), "lobType must be a value from the java.sql.Types class");
|
||||
Assert.state(isValidTypes(clobType), "lobType must be a value from the java.sql.Types class");
|
||||
}
|
||||
|
||||
if (this.conversionService == null) {
|
||||
|
||||
@@ -99,7 +99,7 @@ public class SimpleChunkProcessor<I, O> implements ChunkProcessor<I>, Initializi
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(itemWriter, "ItemWriter must be set");
|
||||
Assert.state(itemWriter != null, "ItemWriter must be set");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2019 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -49,7 +49,7 @@ public class CallableTaskletAdapter implements Tasklet, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(callable, "A Callable is required");
|
||||
Assert.state(callable != null, "A Callable is required");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,6 +37,8 @@ import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link Tasklet} that executes a system command.
|
||||
@@ -190,14 +192,13 @@ public class SystemCommandTasklet implements StepExecutionListener, StoppableTas
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(commandRunner, "CommandRunner must be set");
|
||||
Assert.notNull(cmdArray, "'cmdArray' property value must not be null");
|
||||
Assert.notEmpty(cmdArray, "'cmdArray' property value is required with at least 1 element");
|
||||
Assert.noNullElements(cmdArray, "'cmdArray' property value must not contain be null elements");
|
||||
Assert.hasLength(cmdArray[0], "'cmdArray' property value is required with at least 1 element");
|
||||
Assert.notNull(systemProcessExitCodeMapper, "SystemProcessExitCodeMapper must be set");
|
||||
Assert.isTrue(timeout > 0, "timeout value must be greater than zero");
|
||||
Assert.notNull(taskExecutor, "taskExecutor is required");
|
||||
Assert.state(commandRunner != null, "CommandRunner must be set");
|
||||
Assert.state(cmdArray != null, "'cmdArray' property value must not be null");
|
||||
Assert.state(!ObjectUtils.isEmpty(cmdArray), "'cmdArray' property value is required with at least 1 element");
|
||||
Assert.state(StringUtils.hasText(cmdArray[0]), "'cmdArray' property value is required with at least 1 element");
|
||||
Assert.state(systemProcessExitCodeMapper != null, "SystemProcessExitCodeMapper must be set");
|
||||
Assert.state(timeout > 0, "timeout value must be greater than zero");
|
||||
Assert.state(taskExecutor != null, "taskExecutor is required");
|
||||
stoppable = jobExplorer != null;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class JobRegistryBeanPostProcessorTests {
|
||||
|
||||
@Test
|
||||
void testInitializationFails() {
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, processor::afterPropertiesSet);
|
||||
Exception exception = assertThrows(IllegalStateException.class, processor::afterPropertiesSet);
|
||||
assertTrue(exception.getMessage().contains("JobRegistry"));
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ class JobExplorerFactoryBeanTests {
|
||||
void testMissingDataSource() {
|
||||
|
||||
factory.setDataSource(null);
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, factory::afterPropertiesSet);
|
||||
Exception exception = assertThrows(IllegalStateException.class, factory::afterPropertiesSet);
|
||||
String message = exception.getMessage();
|
||||
assertTrue(message.contains("DataSource"), "Wrong message: " + message);
|
||||
|
||||
|
||||
@@ -41,13 +41,13 @@ class CompositeJobParametersValidatorTests {
|
||||
@Test
|
||||
void testValidatorsCanNotBeNull() {
|
||||
compositeJobParametersValidator.setValidators(null);
|
||||
assertThrows(IllegalArgumentException.class, compositeJobParametersValidator::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, compositeJobParametersValidator::afterPropertiesSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testValidatorsCanNotBeEmpty() {
|
||||
compositeJobParametersValidator.setValidators(new ArrayList<>());
|
||||
assertThrows(IllegalArgumentException.class, compositeJobParametersValidator::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, compositeJobParametersValidator::afterPropertiesSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -120,7 +120,7 @@ class ExtendedAbstractJobTests {
|
||||
@Test
|
||||
void testAfterPropertiesSet() {
|
||||
job.setJobRepository(null);
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, () -> job.afterPropertiesSet());
|
||||
Exception exception = assertThrows(IllegalStateException.class, () -> job.afterPropertiesSet());
|
||||
assertTrue(exception.getMessage().contains("JobRepository"));
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ class SimpleJobOperatorTests {
|
||||
@Test
|
||||
void testMandatoryProperties() {
|
||||
jobOperator = new SimpleJobOperator();
|
||||
assertThrows(IllegalArgumentException.class, jobOperator::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, jobOperator::afterPropertiesSet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -247,7 +247,7 @@ class ExecutionContextPromotionListenerTests {
|
||||
void keysMustBeSet() {
|
||||
ExecutionContextPromotionListener listener = new ExecutionContextPromotionListener();
|
||||
// didn't set the keys, same as listener.setKeys(null);
|
||||
assertThrows(IllegalArgumentException.class, listener::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, listener::afterPropertiesSet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ class JobRepositoryFactoryBeanTests {
|
||||
void testMissingDataSource() {
|
||||
|
||||
factory.setDataSource(null);
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, factory::afterPropertiesSet);
|
||||
Exception exception = assertThrows(IllegalStateException.class, factory::afterPropertiesSet);
|
||||
String message = exception.getMessage();
|
||||
assertTrue(message.contains("DataSource"), "Wrong message: " + message);
|
||||
|
||||
@@ -255,7 +255,7 @@ class JobRepositoryFactoryBeanTests {
|
||||
when(incrementerFactory.isSupportedIncrementerType("mockDb")).thenReturn(true);
|
||||
when(incrementerFactory.getSupportedIncrementerTypes()).thenReturn(new String[0]);
|
||||
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, () -> factory.afterPropertiesSet());
|
||||
Exception exception = assertThrows(IllegalStateException.class, () -> factory.afterPropertiesSet());
|
||||
String message = exception.getMessage();
|
||||
assertTrue(message.contains("TransactionManager"), "Wrong message: " + message);
|
||||
|
||||
@@ -268,7 +268,7 @@ class JobRepositoryFactoryBeanTests {
|
||||
when(incrementerFactory.isSupportedIncrementerType("foo")).thenReturn(false);
|
||||
when(incrementerFactory.getSupportedIncrementerTypes()).thenReturn(new String[0]);
|
||||
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, () -> factory.afterPropertiesSet());
|
||||
Exception exception = assertThrows(IllegalStateException.class, () -> factory.afterPropertiesSet());
|
||||
String message = exception.getMessage();
|
||||
assertTrue(message.contains("foo"), "Wrong message: " + message);
|
||||
|
||||
@@ -363,7 +363,7 @@ class JobRepositoryFactoryBeanTests {
|
||||
@Test
|
||||
void testInvalidCustomLobType() {
|
||||
factory.setClobType(Integer.MAX_VALUE);
|
||||
assertThrows(IllegalArgumentException.class, this::testCreateRepository);
|
||||
assertThrows(IllegalStateException.class, this::testCreateRepository);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -40,7 +40,7 @@ class CallableTaskletAdapterTests {
|
||||
|
||||
@Test
|
||||
void testAfterPropertiesSet() {
|
||||
assertThrows(IllegalArgumentException.class, adapter::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, adapter::afterPropertiesSet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ class SystemCommandTaskletIntegrationTests {
|
||||
@Test
|
||||
public void testCommandRunnerNotSet() throws Exception {
|
||||
tasklet.setCommandRunner(null);
|
||||
assertThrows(IllegalArgumentException.class, tasklet::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, tasklet::afterPropertiesSet);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -196,10 +196,10 @@ class SystemCommandTaskletIntegrationTests {
|
||||
@Test
|
||||
void testCommandNotSet() {
|
||||
tasklet.setCommand(null);
|
||||
assertThrows(IllegalArgumentException.class, tasklet::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, tasklet::afterPropertiesSet);
|
||||
|
||||
tasklet.setCommand("");
|
||||
assertThrows(IllegalArgumentException.class, tasklet::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, tasklet::afterPropertiesSet);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -209,7 +209,7 @@ class SystemCommandTaskletIntegrationTests {
|
||||
void testTimeoutNotSet() {
|
||||
tasklet.setCommand("not-empty placeholder");
|
||||
tasklet.setTimeout(0);
|
||||
assertThrows(IllegalArgumentException.class, tasklet::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, tasklet::afterPropertiesSet);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -76,7 +76,7 @@ public class DataSourceInitializer implements InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(dataSource, "A DataSource is required");
|
||||
Assert.state(dataSource != null, "A DataSource is required");
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
||||
@@ -1397,7 +1397,7 @@ public class FileDeletingTasklet implements Tasklet, InitializingBean {
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(directory, "directory must be set");
|
||||
Assert.state(directory != null, "directory must be set");
|
||||
}
|
||||
}
|
||||
----
|
||||
|
||||
@@ -93,7 +93,7 @@ public abstract class KeyValueItemWriter<K, V> implements ItemWriter<V>, Initial
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(itemKeyMapper, "itemKeyMapper requires a Converter type.");
|
||||
Assert.state(itemKeyMapper != null, "itemKeyMapper requires a Converter type.");
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.MethodInvoker;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Superclass for delegating classes which dynamically call a custom method of injected
|
||||
@@ -126,8 +127,8 @@ public abstract class AbstractMethodInvokingDelegator<T> implements Initializing
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(targetObject, "targetObject must not be null");
|
||||
Assert.hasLength(targetMethod, "targetMethod must not be empty");
|
||||
Assert.state(targetObject != null, "targetObject must not be null");
|
||||
Assert.state(StringUtils.hasText(targetMethod), "targetMethod must not be empty");
|
||||
Assert.state(targetClassDeclaresTargetMethod(),
|
||||
"target class must declare a method with matching name and parameter types");
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.beans.BeanWrapper;
|
||||
import org.springframework.beans.BeanWrapperImpl;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Delegates processing to a custom method - extracts property values from item object and
|
||||
@@ -62,7 +63,8 @@ public class PropertyExtractingDelegatingItemWriter<T> extends AbstractMethodInv
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notEmpty(fieldsUsedAsTargetMethodArguments, "fieldsUsedAsTargetMethodArguments must not be empty");
|
||||
Assert.state(!ObjectUtils.isEmpty(fieldsUsedAsTargetMethodArguments),
|
||||
"fieldsUsedAsTargetMethodArguments must not be empty");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.MethodInvoker;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -129,7 +130,7 @@ public class RepositoryItemWriter<T> implements ItemWriter<T>, InitializingBean
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(repository != null, "A CrudRepository implementation is required");
|
||||
if (this.methodName != null) {
|
||||
Assert.hasText(this.methodName, "methodName must not be empty.");
|
||||
Assert.state(StringUtils.hasText(this.methodName), "methodName must not be empty.");
|
||||
}
|
||||
else {
|
||||
logger.debug("No method name provided, CrudRepository.saveAll will be used.");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -154,7 +154,7 @@ public abstract class AbstractCursorItemReader<T> extends AbstractItemCountingIt
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(dataSource, "DataSource must be provided");
|
||||
Assert.state(dataSource != null, "DataSource must be provided");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,7 +91,7 @@ public abstract class AbstractPagingItemReader<T> extends AbstractItemCountingIt
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.isTrue(pageSize > 0, "pageSize must be greater than zero");
|
||||
Assert.state(pageSize > 0, "pageSize must be greater than zero");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -316,7 +316,7 @@ public class ExtendedConnectionDataSourceProxy implements SmartDataSource, Initi
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(dataSource, "DataSource is required");
|
||||
Assert.state(dataSource != null, "DataSource is required");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -101,7 +101,7 @@ public class HibernateItemReaderHelper<T> implements InitializingBean {
|
||||
Assert.state(sessionFactory != null, "A SessionFactory must be provided");
|
||||
|
||||
if (queryProvider == null) {
|
||||
Assert.notNull(sessionFactory, "session factory must be set");
|
||||
Assert.state(sessionFactory != null, "session factory must be set");
|
||||
Assert.state(StringUtils.hasText(queryString) ^ StringUtils.hasText(queryName),
|
||||
"queryString or queryName must be set");
|
||||
}
|
||||
|
||||
@@ -142,8 +142,8 @@ public class JdbcBatchItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(namedParameterJdbcTemplate, "A DataSource or a NamedParameterJdbcTemplate is required.");
|
||||
Assert.notNull(sql, "An SQL statement is required.");
|
||||
Assert.state(namedParameterJdbcTemplate != null, "A DataSource or a NamedParameterJdbcTemplate is required.");
|
||||
Assert.state(sql != null, "An SQL statement is required.");
|
||||
List<String> namedParameters = new ArrayList<>();
|
||||
parameterCount = JdbcParameterUtils.countParameterPlaceholders(sql, namedParameters);
|
||||
if (namedParameters.size() > 0) {
|
||||
@@ -154,7 +154,7 @@ public class JdbcBatchItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
usingNamedParameters = true;
|
||||
}
|
||||
if (!usingNamedParameters) {
|
||||
Assert.notNull(itemPreparedStatementSetter,
|
||||
Assert.state(itemPreparedStatementSetter != null,
|
||||
"Using SQL statement with '?' placeholders requires an ItemPreparedStatementSetter");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -103,8 +103,8 @@ public class JdbcCursorItemReader<T> extends AbstractCursorItemReader<T> {
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(sql, "The SQL query must be provided");
|
||||
Assert.notNull(rowMapper, "RowMapper must be provided");
|
||||
Assert.state(sql != null, "The SQL query must be provided");
|
||||
Assert.state(rowMapper != null, "RowMapper must be provided");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -155,14 +155,14 @@ public class JdbcPagingItemReader<T> extends AbstractPagingItemReader<T> impleme
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(dataSource, "DataSource may not be null");
|
||||
Assert.state(dataSource != null, "DataSource may not be null");
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
if (fetchSize != VALUE_NOT_SET) {
|
||||
jdbcTemplate.setFetchSize(fetchSize);
|
||||
}
|
||||
jdbcTemplate.setMaxRows(getPageSize());
|
||||
namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(jdbcTemplate);
|
||||
Assert.notNull(queryProvider, "QueryProvider may not be null");
|
||||
Assert.state(queryProvider != null, "QueryProvider may not be null");
|
||||
queryProvider.init(dataSource);
|
||||
this.firstPageSql = queryProvider.generateFirstPageQuery(getPageSize());
|
||||
this.remainingPagesSql = queryProvider.generateRemainingPagesQuery(getPageSize());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2021 the original author or authors.
|
||||
* Copyright 2020-2022 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.
|
||||
@@ -30,6 +30,7 @@ import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link org.springframework.batch.item.ItemStreamReader} implementation based on JPA
|
||||
@@ -101,9 +102,10 @@ public class JpaCursorItemReader<T> extends AbstractItemCountingItemStreamItemRe
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(this.entityManagerFactory, "EntityManagerFactory is required");
|
||||
Assert.state(this.entityManagerFactory != null, "EntityManagerFactory is required");
|
||||
if (this.queryProvider == null) {
|
||||
Assert.hasLength(this.queryString, "Query string is required when queryProvider is null");
|
||||
Assert.state(StringUtils.hasLength(this.queryString),
|
||||
"Query string is required when queryProvider is null");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public class JpaItemWriter<T> implements ItemWriter<T>, InitializingBean {
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(entityManagerFactory, "An EntityManagerFactory is required");
|
||||
Assert.state(entityManagerFactory != null, "An EntityManagerFactory is required");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.batch.item.database.orm.JpaQueryProvider;
|
||||
import org.springframework.dao.DataAccessResourceFailureException;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -144,8 +145,8 @@ public class JpaPagingItemReader<T> extends AbstractPagingItemReader<T> {
|
||||
super.afterPropertiesSet();
|
||||
|
||||
if (queryProvider == null) {
|
||||
Assert.notNull(entityManagerFactory, "EntityManager is required when queryProvider is null");
|
||||
Assert.hasLength(queryString, "Query string is required when queryProvider is null");
|
||||
Assert.state(entityManagerFactory != null, "EntityManager is required when queryProvider is null");
|
||||
Assert.state(StringUtils.hasLength(queryString), "Query string is required when queryProvider is null");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -143,8 +143,8 @@ public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> {
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(procedureName, "The name of the stored procedure must be provided");
|
||||
Assert.notNull(rowMapper, "RowMapper must be provided");
|
||||
Assert.state(procedureName != null, "The name of the stored procedure must be provided");
|
||||
Assert.state(rowMapper != null, "RowMapper must be provided");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -69,8 +69,8 @@ public class HibernateNativeQueryProvider<E> extends AbstractHibernateQueryProvi
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.isTrue(StringUtils.hasText(sqlQuery), "Native SQL query cannot be empty");
|
||||
Assert.notNull(entityClass, "Entity class cannot be NULL");
|
||||
Assert.state(StringUtils.hasText(sqlQuery), "Native SQL query cannot be empty");
|
||||
Assert.state(entityClass != null, "Entity class cannot be NULL");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2021 the original author or authors.
|
||||
* Copyright 2020-2022 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.
|
||||
@@ -57,8 +57,8 @@ public class JpaNamedQueryProvider<E> extends AbstractJpaQueryProvider {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.isTrue(StringUtils.hasText(this.namedQuery), "Named query cannot be empty");
|
||||
Assert.notNull(this.entityClass, "Entity class cannot be NULL");
|
||||
Assert.state(StringUtils.hasText(this.namedQuery), "Named query cannot be empty");
|
||||
Assert.state(this.entityClass != null, "Entity class cannot be NULL");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -53,8 +53,8 @@ public class JpaNativeQueryProvider<E> extends AbstractJpaQueryProvider {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.isTrue(StringUtils.hasText(sqlQuery), "Native SQL query cannot be empty");
|
||||
Assert.notNull(entityClass, "Entity class cannot be NULL");
|
||||
Assert.state(StringUtils.hasText(sqlQuery), "Native SQL query cannot be empty");
|
||||
Assert.state(entityClass != null, "Entity class cannot be NULL");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ public class FlatFileItemReader<T> extends AbstractItemCountingItemStreamItemRea
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(lineMapper, "LineMapper is required");
|
||||
Assert.state(lineMapper != null, "LineMapper is required");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ public class FlatFileItemWriter<T> extends AbstractFileItemWriter<T> {
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(lineAggregator, "A LineAggregator must be provided.");
|
||||
Assert.state(lineAggregator != null, "A LineAggregator must be provided.");
|
||||
if (append) {
|
||||
shouldDeleteIfExists = false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -52,8 +52,8 @@ public class DefaultLineMapper<T> implements LineMapper<T>, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(tokenizer, "The LineTokenizer must be set");
|
||||
Assert.notNull(fieldSetMapper, "The FieldSetMapper must be set");
|
||||
Assert.state(tokenizer != null, "The LineTokenizer must be set");
|
||||
Assert.state(fieldSetMapper != null, "The FieldSetMapper must be set");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -68,7 +68,7 @@ public class PatternMatchingCompositeLineMapper<T> implements LineMapper<T>, Ini
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
this.tokenizer.afterPropertiesSet();
|
||||
Assert.isTrue(this.patternMatcher != null, "The 'patternMatcher' property must be non-null");
|
||||
Assert.state(this.patternMatcher != null, "The 'patternMatcher' property must be non-null");
|
||||
}
|
||||
|
||||
public void setTokenizers(Map<String, LineTokenizer> tokenizers) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -60,7 +60,7 @@ public class BeanWrapperFieldExtractor<T> implements FieldExtractor<T>, Initiali
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(names, "The 'names' property must be set.");
|
||||
Assert.state(names != null, "The 'names' property must be set.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2020 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -274,7 +274,7 @@ public class DelimitedLineTokenizer extends AbstractLineTokenizer implements Ini
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.hasLength(this.delimiter, "A delimiter is required");
|
||||
Assert.state(StringUtils.hasLength(this.delimiter), "A delimiter is required");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2019 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -56,7 +56,7 @@ public class PatternMatchingCompositeLineTokenizer implements LineTokenizer, Ini
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.isTrue(this.tokenizers != null, "The 'tokenizers' property must be non-empty");
|
||||
Assert.state(this.tokenizers != null, "The 'tokenizers' property must be non-empty");
|
||||
}
|
||||
|
||||
public void setTokenizers(Map<String, LineTokenizer> tokenizers) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -90,7 +90,7 @@ public class JmsItemReader<T> implements ItemReader<T>, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(this.jmsTemplate, "The 'jmsTemplate' is required.");
|
||||
Assert.state(this.jmsTemplate != null, "The 'jmsTemplate' is required.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -72,8 +72,8 @@ public class KafkaItemWriter<K, T> extends KeyValueItemWriter<K, T> {
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
Assert.notNull(this.kafkaTemplate, "KafkaTemplate must not be null.");
|
||||
Assert.notNull(this.kafkaTemplate.getDefaultTopic(), "KafkaTemplate must have the default topic set.");
|
||||
Assert.state(this.kafkaTemplate != null, "KafkaTemplate must not be null.");
|
||||
Assert.state(this.kafkaTemplate.getDefaultTopic() != null, "KafkaTemplate must have the default topic set.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2019 the original author or authors.
|
||||
* Copyright 2005-2022 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.
|
||||
@@ -175,8 +175,8 @@ public class LdifReader extends AbstractItemCountingItemStreamItemReader<LdapAtt
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(resource, "A resource is required to parse.");
|
||||
Assert.notNull(ldifParser, "A parser is required");
|
||||
Assert.state(resource != null, "A resource is required to parse.");
|
||||
Assert.state(ldifParser != null, "A parser is required");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2005-2019 the original author or authors.
|
||||
* Copyright 2005-2022 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.
|
||||
@@ -172,8 +172,8 @@ public class MappingLdifReader<T> extends AbstractItemCountingItemStreamItemRead
|
||||
}
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(resource, "A resource is required to parse.");
|
||||
Assert.notNull(ldifParser, "A parser is required");
|
||||
Assert.state(resource != null, "A resource is required to parse.");
|
||||
Assert.state(ldifParser != null, "A parser is required");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,8 +93,8 @@ public class CompositeItemProcessor<I, O> implements ItemProcessor<I, O>, Initia
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(delegates, "The 'delegates' may not be null");
|
||||
Assert.notEmpty(delegates, "The 'delegates' may not be empty");
|
||||
Assert.state(delegates != null, "The 'delegates' may not be null");
|
||||
Assert.state(!delegates.isEmpty(), "The 'delegates' may not be empty");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -88,8 +88,8 @@ public class CompositeItemWriter<T> implements ItemStreamWriter<T>, Initializing
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(delegates, "The 'delegates' may not be null");
|
||||
Assert.notEmpty(delegates, "The 'delegates' may not be empty");
|
||||
Assert.state(delegates != null, "The 'delegates' may not be null");
|
||||
Assert.state(!delegates.isEmpty(), "The 'delegates' may not be empty");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2021 the original author or authors.
|
||||
* Copyright 2014-2022 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.
|
||||
@@ -139,7 +139,7 @@ public class ScriptItemProcessor<I, O> implements ItemProcessor<I, O>, Initializ
|
||||
"Either a script source or script file must be provided, not both");
|
||||
|
||||
if (scriptSource != null && scriptEvaluator instanceof StandardScriptEvaluator) {
|
||||
Assert.isTrue(StringUtils.hasLength(language),
|
||||
Assert.state(StringUtils.hasLength(language),
|
||||
"Language must be provided when using the default ScriptEvaluator and raw source code");
|
||||
|
||||
((StandardScriptEvaluator) scriptEvaluator).setLanguage(language);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015-2019 the original author or authors.
|
||||
* Copyright 2015-2022 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.
|
||||
@@ -71,7 +71,7 @@ public class SynchronizedItemStreamReader<T> implements ItemStreamReader<T>, Ini
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(this.delegate, "A delegate item reader is required");
|
||||
Assert.state(this.delegate != null, "A delegate item reader is required");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class SynchronizedItemStreamWriter<T> implements ItemStreamWriter<T>, Ini
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(this.delegate, "A delegate item writer is required");
|
||||
Assert.state(this.delegate != null, "A delegate item writer is required");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -85,7 +85,7 @@ public class SpringValidator<T> implements Validator<T>, InitializingBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(validator, "validator must be set");
|
||||
Assert.state(validator != null, "validator must be set");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2019 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -91,7 +91,7 @@ public class ValidatingItemProcessor<T> implements ItemProcessor<T, T>, Initiali
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(validator, "Validator must not be null.");
|
||||
Assert.state(validator != null, "Validator must not be null.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -160,10 +160,10 @@ public class StaxEventItemReader<T> extends AbstractItemCountingItemStreamItemRe
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(unmarshaller, "The Unmarshaller must not be null.");
|
||||
Assert.notEmpty(fragmentRootElementNames, "The FragmentRootElementNames must not be empty");
|
||||
Assert.state(unmarshaller != null, "The Unmarshaller must not be null.");
|
||||
Assert.state(!fragmentRootElementNames.isEmpty(), "The FragmentRootElementNames must not be empty");
|
||||
for (QName fragmentRootElementName : fragmentRootElementNames) {
|
||||
Assert.hasText(fragmentRootElementName.getLocalPart(),
|
||||
Assert.state(StringUtils.hasText(fragmentRootElementName.getLocalPart()),
|
||||
"The FragmentRootElementNames must not contain empty elements");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ public class StaxEventItemWriter<T> extends AbstractItemStreamItemWriter<T>
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(marshaller, "A Marshaller is required");
|
||||
Assert.state(marshaller != null, "A Marshaller is required");
|
||||
if (rootTagName.contains("{")) {
|
||||
rootTagNamespace = rootTagName.replaceAll("\\{(.*)\\}.*", "$1");
|
||||
rootTagName = rootTagName.replaceAll("\\{.*\\}(.*)", "$1");
|
||||
|
||||
@@ -60,7 +60,7 @@ class RepositoryItemWriterTests {
|
||||
writer.setRepository(repository);
|
||||
writer.setMethodName("");
|
||||
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, writer::afterPropertiesSet);
|
||||
Exception exception = assertThrows(IllegalStateException.class, writer::afterPropertiesSet);
|
||||
assertEquals("methodName must not be empty.", exception.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ class ExtendedConnectionDataSourceProxyTests {
|
||||
void delegateIsRequired() {
|
||||
|
||||
ExtendedConnectionDataSourceProxy tested = new ExtendedConnectionDataSourceProxy(null);
|
||||
assertThrows(IllegalArgumentException.class, tested::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, tested::afterPropertiesSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -85,17 +85,17 @@ class JdbcBatchItemWriterClassicTests {
|
||||
@Test
|
||||
void testAfterPropertiesSet() {
|
||||
writer = new JdbcBatchItemWriter<>();
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, writer::afterPropertiesSet);
|
||||
Exception exception = assertThrows(IllegalStateException.class, writer::afterPropertiesSet);
|
||||
assertTrue(exception.getMessage().contains("NamedParameterJdbcTemplate"),
|
||||
"Message does not contain ' NamedParameterJdbcTemplate'.");
|
||||
|
||||
writer.setJdbcTemplate(new NamedParameterJdbcTemplate(jdbcTemplate));
|
||||
exception = assertThrows(IllegalArgumentException.class, writer::afterPropertiesSet);
|
||||
exception = assertThrows(IllegalStateException.class, writer::afterPropertiesSet);
|
||||
String message = exception.getMessage();
|
||||
assertTrue(message.toLowerCase().contains("sql"), "Message does not contain 'sql'.");
|
||||
|
||||
writer.setSql("select * from foo where id = ?");
|
||||
exception = assertThrows(IllegalArgumentException.class, writer::afterPropertiesSet);
|
||||
exception = assertThrows(IllegalStateException.class, writer::afterPropertiesSet);
|
||||
assertTrue(exception.getMessage().contains("ItemPreparedStatementSetter"),
|
||||
"Message does not contain 'ItemPreparedStatementSetter'.");
|
||||
|
||||
|
||||
@@ -101,13 +101,13 @@ public class JdbcBatchItemWriterNamedParameterTests {
|
||||
@Test
|
||||
void testAfterPropertiesSet() {
|
||||
writer = new JdbcBatchItemWriter<>();
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, writer::afterPropertiesSet);
|
||||
Exception exception = assertThrows(IllegalStateException.class, writer::afterPropertiesSet);
|
||||
String message = exception.getMessage();
|
||||
assertTrue(message.contains("NamedParameterJdbcTemplate"),
|
||||
"Message does not contain 'NamedParameterJdbcTemplate'.");
|
||||
|
||||
writer.setJdbcTemplate(namedParameterJdbcOperations);
|
||||
exception = assertThrows(IllegalArgumentException.class, writer::afterPropertiesSet);
|
||||
exception = assertThrows(IllegalStateException.class, writer::afterPropertiesSet);
|
||||
message = exception.getMessage().toLowerCase();
|
||||
assertTrue(message.contains("sql"), "Message does not contain 'sql'.");
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class JpaItemWriterTests {
|
||||
@Test
|
||||
void testAfterPropertiesSet() {
|
||||
writer = new JpaItemWriter<>();
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, writer::afterPropertiesSet);
|
||||
Exception exception = assertThrows(IllegalStateException.class, writer::afterPropertiesSet);
|
||||
String message = exception.getMessage();
|
||||
assertTrue(message.contains("EntityManagerFactory"), "Wrong message for exception: " + message);
|
||||
}
|
||||
|
||||
@@ -545,7 +545,7 @@ class FlatFileItemWriterTests {
|
||||
@Test
|
||||
void testAfterPropertiesSetChecksMandatory() {
|
||||
writer = new FlatFileItemWriter<>();
|
||||
assertThrows(IllegalArgumentException.class, writer::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, writer::afterPropertiesSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -35,13 +35,13 @@ class DefaultLineMapperTests {
|
||||
|
||||
@Test
|
||||
void testMandatoryTokenizer() {
|
||||
assertThrows(IllegalArgumentException.class, tested::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, tested::afterPropertiesSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMandatoryMapper() {
|
||||
tested.setLineTokenizer(new DelimitedLineTokenizer());
|
||||
assertThrows(IllegalArgumentException.class, tested::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, tested::afterPropertiesSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -140,7 +140,7 @@ class DelimitedLineTokenizerTests {
|
||||
@Test
|
||||
void testDelimitedLineTokenizerEmptyString() {
|
||||
DelimitedLineTokenizer tokenizer = new DelimitedLineTokenizer("");
|
||||
assertThrows(IllegalArgumentException.class, tokenizer::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, tokenizer::afterPropertiesSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -38,7 +38,7 @@ class PatternMatchingCompositeLineTokenizerTests {
|
||||
|
||||
@Test
|
||||
void testNoTokenizers() {
|
||||
assertThrows(IllegalArgumentException.class, tokenizer::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, tokenizer::afterPropertiesSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -69,11 +69,11 @@ class KafkaItemWriterTests {
|
||||
void testAfterPropertiesSet() {
|
||||
this.writer = new KafkaItemWriter<>();
|
||||
|
||||
Exception exception = assertThrows(IllegalArgumentException.class, () -> this.writer.afterPropertiesSet());
|
||||
Exception exception = assertThrows(IllegalStateException.class, () -> this.writer.afterPropertiesSet());
|
||||
assertEquals("itemKeyMapper requires a Converter type.", exception.getMessage());
|
||||
|
||||
this.writer.setItemKeyMapper(this.itemKeyMapper);
|
||||
exception = assertThrows(IllegalArgumentException.class, () -> this.writer.afterPropertiesSet());
|
||||
exception = assertThrows(IllegalStateException.class, () -> this.writer.afterPropertiesSet());
|
||||
assertEquals("KafkaTemplate must not be null.", exception.getMessage());
|
||||
|
||||
this.writer.setKafkaTemplate(this.kafkaTemplate);
|
||||
|
||||
@@ -103,11 +103,11 @@ class CompositeItemProcessorTests {
|
||||
|
||||
// value not set
|
||||
composite.setDelegates(null);
|
||||
assertThrows(IllegalArgumentException.class, composite::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, composite::afterPropertiesSet);
|
||||
|
||||
// empty list
|
||||
composite.setDelegates(new ArrayList<ItemProcessor<Object, Object>>());
|
||||
assertThrows(IllegalArgumentException.class, composite::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, composite::afterPropertiesSet);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class SynchronizedItemStreamWriterTests extends AbstractSynchronizedItemStreamWr
|
||||
|
||||
@Test
|
||||
void testDelegateIsNotNullWhenPropertiesSet() {
|
||||
final Exception expectedException = assertThrows(IllegalArgumentException.class,
|
||||
final Exception expectedException = assertThrows(IllegalStateException.class,
|
||||
() -> ((InitializingBean) new SynchronizedItemStreamWriter<>()).afterPropertiesSet());
|
||||
assertEquals("A delegate item writer is required", expectedException.getMessage());
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class SpringValidatorTests {
|
||||
@Test
|
||||
void testNullValidator() {
|
||||
validator.setValidator(null);
|
||||
assertThrows(IllegalArgumentException.class, validator::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, validator::afterPropertiesSet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -116,11 +116,11 @@ class StaxEventItemReaderTests {
|
||||
|
||||
source = createNewInputSource();
|
||||
source.setFragmentRootElementName("");
|
||||
assertThrows(IllegalArgumentException.class, source::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, source::afterPropertiesSet);
|
||||
|
||||
source = createNewInputSource();
|
||||
source.setUnmarshaller(null);
|
||||
assertThrows(IllegalArgumentException.class, source::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, source::afterPropertiesSet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -104,7 +104,7 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(dataSource, "A DataSource is required");
|
||||
Assert.state(dataSource != null, "A DataSource is required");
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2019 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -59,7 +59,7 @@ public class AsyncItemProcessor<I, O> implements ItemProcessor<I, Future<O>>, In
|
||||
* @see InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(delegate, "The delegate must be set.");
|
||||
Assert.state(delegate != null, "The delegate must be set.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,7 +39,7 @@ public class AsyncItemWriter<T> implements ItemStreamWriter<Future<T>>, Initiali
|
||||
private ItemWriter<T> delegate;
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(delegate, "A delegate ItemWriter must be provided.");
|
||||
Assert.state(delegate != null, "A delegate ItemWriter must be provided.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ChunkProcessorChunkHandler<S> implements ChunkHandler<S>, Initializ
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(chunkProcessor, "A ChunkProcessor must be provided");
|
||||
Assert.state(chunkProcessor != null, "A ChunkProcessor must be provided");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -111,7 +111,7 @@ public class MessageChannelPartitionHandler extends AbstractPartitionHandler imp
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(stepName, "A step name must be provided for the remote workers.");
|
||||
Assert.state(stepName != null, "A step name must be provided for the remote workers.");
|
||||
Assert.state(messagingGateway != null, "The MessagingOperations must be set");
|
||||
|
||||
pollRepositoryForResults = !(dataSource == null && jobExplorer == null);
|
||||
|
||||
@@ -46,7 +46,7 @@ class AsyncItemProcessorTests {
|
||||
|
||||
@Test
|
||||
void testNoDelegate() {
|
||||
assertThrows(IllegalArgumentException.class, processor::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, processor::afterPropertiesSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2012 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -39,7 +39,7 @@ public class StagingItemListener extends StepListenerSupport<Long, Long> impleme
|
||||
|
||||
@Override
|
||||
public final void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jdbcTemplate, "You must provide a DataSource.");
|
||||
Assert.state(jdbcTemplate != null, "You must provide a DataSource.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009-2019 the original author or authors.
|
||||
* Copyright 2009-2022 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.
|
||||
@@ -49,7 +49,7 @@ public class StagingItemProcessor<T> implements ItemProcessor<ProcessIndicatorIt
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jdbcTemplate, "Either jdbcTemplate or dataSource must be set");
|
||||
Assert.state(jdbcTemplate != null, "Either jdbcTemplate or dataSource must be set");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -72,7 +72,7 @@ public class StagingItemReader<T>
|
||||
|
||||
@Override
|
||||
public final void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jdbcTemplate, "You must provide a DataSource.");
|
||||
Assert.state(jdbcTemplate != null, "You must provide a DataSource.");
|
||||
}
|
||||
|
||||
private List<Long> retrieveKeys() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -68,7 +68,7 @@ public class AggregateItemFieldSetMapper<T> implements FieldSetMapper<AggregateI
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(delegate, "A FieldSetMapper delegate must be provided.");
|
||||
Assert.state(delegate != null, "A FieldSetMapper delegate must be provided.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,7 @@ public class HibernateAwareCustomerCreditItemWriter implements ItemWriter<Custom
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(sessionFactory != null, "Hibernate SessionFactory is required");
|
||||
Assert.notNull(dao, "Delegate DAO must be set");
|
||||
Assert.state(dao != null, "Delegate DAO must be set");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2021 the original author or authors.
|
||||
* Copyright 2006-2022 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.
|
||||
@@ -47,7 +47,7 @@ public class GeneratingTradeResettingListener implements StepExecutionListener,
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(this.reader, "The 'reader' must be set.");
|
||||
Assert.state(this.reader != null, "The 'reader' must be set.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ class AggregateItemFieldSetMapperTests {
|
||||
|
||||
@Test
|
||||
void testMandatoryProperties() {
|
||||
assertThrows(IllegalArgumentException.class, mapper::afterPropertiesSet);
|
||||
assertThrows(IllegalStateException.class, mapper::afterPropertiesSet);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -107,7 +107,7 @@ public class DataSourceInitializer implements InitializingBean, DisposableBean {
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(this.dataSource, "A DataSource is required");
|
||||
Assert.state(this.dataSource != null, "A DataSource is required");
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user