EMMA Coverage Report (generated Thu May 22 12:08:10 CDT 2014)
[all classes][org.springframework.batch.core.configuration.annotation]

COVERAGE SUMMARY FOR SOURCE FILE [ModularBatchConfiguration.java]

nameclass, %method, %block, %line, %
ModularBatchConfiguration.java100% (1/1)100% (5/5)100% (56/56)100% (10/10)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ModularBatchConfiguration100% (1/1)100% (5/5)100% (56/56)100% (10/10)
ModularBatchConfiguration (): void 100% (1/1)100% (8/8)100% (2/2)
jobLauncher (): JobLauncher 100% (1/1)100% (6/6)100% (1/1)
jobRegistrar (): AutomaticJobRegistrar 100% (1/1)100% (30/30)100% (5/5)
jobRepository (): JobRepository 100% (1/1)100% (6/6)100% (1/1)
transactionManager (): PlatformTransactionManager 100% (1/1)100% (6/6)100% (1/1)

1/*
2 * Copyright 2012-2013 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.springframework.batch.core.configuration.annotation;
17 
18import java.util.Collection;
19 
20import org.springframework.batch.core.configuration.support.ApplicationContextFactory;
21import org.springframework.batch.core.configuration.support.AutomaticJobRegistrar;
22import org.springframework.batch.core.configuration.support.DefaultJobLoader;
23import org.springframework.batch.core.launch.JobLauncher;
24import org.springframework.batch.core.repository.JobRepository;
25import org.springframework.beans.factory.annotation.Autowired;
26import org.springframework.context.ApplicationContext;
27import org.springframework.context.annotation.Bean;
28import org.springframework.context.annotation.Configuration;
29import org.springframework.transaction.PlatformTransactionManager;
30 
31/**
32 * Base {@code Configuration} class providing common structure for enabling and using Spring Batch. Customization is
33 * available by implementing the {@link BatchConfigurer} interface.
34 *
35 * @author Dave Syer
36 * @since 2.2
37 * @see EnableBatchProcessing
38 */
39@Configuration
40public class ModularBatchConfiguration extends AbstractBatchConfiguration {
41 
42        @Autowired
43        private ApplicationContext context;
44 
45        @Autowired(required = false)
46        private Collection<BatchConfigurer> configurers;
47 
48        private AutomaticJobRegistrar registrar = new AutomaticJobRegistrar();
49 
50        @Override
51        @Bean
52        public JobRepository jobRepository() throws Exception {
53                return getConfigurer(configurers).getJobRepository();
54        }
55 
56        @Override
57        @Bean
58        public JobLauncher jobLauncher() throws Exception {
59                return getConfigurer(configurers).getJobLauncher();
60        }
61 
62        @Override
63        @Bean
64        public PlatformTransactionManager transactionManager() throws Exception {
65                return getConfigurer(configurers).getTransactionManager();
66        }
67 
68        @Bean
69        public AutomaticJobRegistrar jobRegistrar() throws Exception {
70                registrar.setJobLoader(new DefaultJobLoader(jobRegistry()));
71                for (ApplicationContextFactory factory : context.getBeansOfType(ApplicationContextFactory.class).values()) {
72                        registrar.addApplicationContextFactory(factory);
73                }
74                return registrar;
75        }
76 
77}

[all classes][org.springframework.batch.core.configuration.annotation]
EMMA 2.0.5312 (C) Vladimir Roubtsov