小编Par*_*ban的帖子

没有“org.springframework.batch.core.Job”类型的合格 bean 可用:预期有单个匹配 bean,但发现了 2 个:

我有 2 个作业在基于输入参数的单个 Spring Batch 应用程序中运行,并且运行成功。但是当我运行测试用例时,我收到以下错误。我正在使用 gradle 来构建我的应用程序。

没有“org.springframework.batch.core.Job”类型的合格 bean 可用:预期有单个匹配 bean,但发现 2:pureRedDataProcessingJob、pcsMasterProcessingJob

测试类:

import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.test.JobLauncherTestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**

 * 
 * @author 
 *
 */
@ContextConfiguration(classes = {UidBatchApplication.class, JobLauncherTestUtils.class}, 
initializers = ConfigFileApplicationContextInitializer.class)
@RunWith(SpringJUnit4ClassRunner.class)
@TestPropertySource(locations = {"classpath:application-test.properties"})
@Configuration
@ActiveProfiles("test")
@Profile("test")
@TestConfiguration
@SpringBootTest
@FixMethodOrder(MethodSorters.NAME_ASCENDING)

@EnableAutoConfiguration

public class UidBatchApplicationTest {


    @Autowired
    public …
Run Code Online (Sandbox Code Playgroud)

junit spring spring-batch spring-boot

7
推荐指数
1
解决办法
3万
查看次数

java.io.IOException:无法运行程序":CreateProcess error = 193,%1不是有效的Win32应用程序

我修复了我的文件路径,但现在尝试在Eclipse中从java运行shell脚本时出现此错误.

我刚刚在我的本地创建了一个文本文件,想看看它是否会运行.

new ProcessBuilder("C:/Users/myDir/Desktop/ss1.sh").start();
Run Code Online (Sandbox Code Playgroud)

java shell

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

java ×1

junit ×1

shell ×1

spring ×1

spring-batch ×1

spring-boot ×1