spring-batch JobBuilderFactory 源码
spring-batch JobBuilderFactory 代码
文件路径:/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/JobBuilderFactory.java
/*
* Copyright 2012-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.
* 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.core.configuration.annotation;
import org.springframework.batch.core.job.builder.JobBuilder;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.util.Assert;
/**
* Convenient factory for a {@link JobBuilder} that sets the {@link JobRepository}
* automatically.
*
* @author Dave Syer
* @author Mahmoud Ben Hassine
*
*/
public class JobBuilderFactory {
private JobRepository jobRepository;
/**
* @param jobRepository The {@link JobRepository} to be used by the builder factory.
* Must not be {@code null}.
*/
public JobBuilderFactory(JobRepository jobRepository) {
Assert.notNull(jobRepository, "JobRepository must not be null");
this.jobRepository = jobRepository;
}
/**
* Creates a job builder and initializes its job repository. Note that, if the builder
* is used to create a @Bean definition, the name of the job and the bean name
* might be different.
* @param name the name of the job
* @return a job builder
*/
public JobBuilder get(String name) {
return new JobBuilder(name).repository(this.jobRepository);
}
}
相关信息
相关文章
spring-batch AbstractBatchConfiguration 源码
spring-batch BatchConfigurationSelector 源码
spring-batch BatchConfigurer 源码
spring-batch DefaultBatchConfigurer 源码
spring-batch EnableBatchProcessing 源码
spring-batch ModularBatchConfiguration 源码
spring-batch ScopeConfiguration 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦