spring-batch StepScope 源码
spring-batch StepScope 代码
文件路径:/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/annotation/StepScope.java
/*
* Copyright 2013-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.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* <p>
* Convenient annotation for step-scoped beans. It defaults the proxy mode so that it need
* not be specified explicitly on every bean definition. Use this on any @Bean that
* needs to inject @Values from the step context and on any bean that needs to share a
* lifecycle with a step execution (such as an ItemStream). The following listing shows an
* example:
* </p>
*
* <pre class="code">
* @Bean
* @StepScope
* protected Callable<String> value(@Value("#{stepExecution.stepName}")
* final String value) {
* return new SimpleCallable(value);
* }
* </pre>
*
* <p>
* Marking a @Bean as @StepScope is equivalent to marking it as
* <code>@Scope(value="step", proxyMode=TARGET_CLASS)</code>
* </p>
*
* @author Dave Syer
*
* @since 2.2
*
*/
@Scope(value = "step", proxyMode = ScopedProxyMode.TARGET_CLASS)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface StepScope {
}
相关信息
相关文章
spring-batch AbstractBatchConfiguration 源码
spring-batch BatchConfigurationSelector 源码
spring-batch BatchConfigurer 源码
spring-batch DefaultBatchConfigurer 源码
spring-batch EnableBatchProcessing 源码
spring-batch JobBuilderFactory 源码
spring-batch ModularBatchConfiguration 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦