我正在使用Spring Boot 2.X应用程序进行Spring

Batch,实际上我已经从git中检出了它的现有代码。在运行该应用程序时,由于以下错误而导致失败仅对我自己,而相同的代码对其他人也有效。

s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'inputItemReader' defined in file [C:\Users\XYZ\git\main\batch\CBatchProcessing\target\classes\com\main\batchprocessing\batch\reader\InputItemReader.class]: Unsatisfied dependency expressed through **constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.lang.String' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations**: {}

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2018-10-16 23:23:37.411 ERROR 2384 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :

***************************

APPLICATION FAILED TO START

***************************

Description:

**Parameter 0 of constructor in com.main.batchprocessing.batch.reader.InputItemReader required a bean of type 'java.lang.String' that could not be found.**

Action:

Consider defining a bean of type 'java.lang.String' in your configuration.

我在下面检查了

所有Spring组件均已使用@ Component,@ Service,@ Controller,@ Repository等正确注释。

还提供了@ComponentScan和@EnableAutoCOnfiguration。

尝试在声明中提供“ java.lang.String”。

码:

import java.util.Map;

import org.slf4j.Logger;

import org.slf4j.LoggerFactory;

import org.springframework.batch.core.ExitStatus;

import org.springframework.batch.core.StepExecution;

import org.springframework.batch.core.StepExecutionListener;

import org.springframework.batch.item.file.FlatFileItemReader;

import org.springframework.batch.item.file.mapping.JsonLineMapper;

import

org.springframework.batch.item.file.separator.JsonRecordSeparatorPolicy;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.context.annotation.Bean;

import org.springframework.core.io.FileSystemResource;

import org.springframework.stereotype.Component;

@Component

public class InputItemReader extends FlatFileItemReader

Object>> implements StepExecutionListener {

@Autowired

private InputFileHeaderValidator inputFileHeaderValidator;

@Autowired

private FileAuditService fileAuditService;

private final Logger log =

LoggerFactory.getLogger(InputItemReader.class);

private java.lang.String inputFilePath;

public InputItemReader(String inputFilePath) {

setLineMapper(new JsonLineMapper());

setRecordSeparatorPolicy(new JsonRecordSeparatorPolicy());

setResource(new FileSystemResource(inputFilePath));

this.inputFilePath = inputFilePath;

}

}

java字符串构造函数的应用_构造函数中的参数0需要找不到类型为'java.lang.String'的bean...相关推荐

  1. java 字符串是对象吗_解析Java中的String对象的数据类型

    解析Java中的String对象的数据类型 2007-06-06 eNet&Ciweek 1. 首先String不属于8种基本数据类型,String是一个对象. 因为对象的默认值是null,所 ...

  2. java字符串删掉子串_如何从Java中的列表中删除子列表?

    java字符串删掉子串 从列表中删除子列表 (Removing SubList from a List) Suppose, we have a list of few elements like th ...

  3. 【批处理DOS-CMD命令-汇总和小结】-批处理命令中的参数%0、%1、%2、%[0-9]、%0-9和批处理命令参数位置切换命令shift,dos命令中操作符%用法

    一.执行CMD命令的3种方式 执行CMD命令的两种方式分别是手动创建一个Cmd窗口和执行bat批处理文件. 第一种,先手动创建一个cmd窗口,然后往里面输入cmd命令,最后回车执行. 第二种,先在一个 ...

  4. java字符串字符排列组合_如何在Java中查找字符串的所有排列

    java字符串字符排列组合 In this tutorial, we will learn how to find the permutation of a String in a Java Prog ...

  5. java字符串拆分成数组_用Java实现JVM第八章《数组和字符串》

    小傅哥 | https://bugstack.cn 沉淀.分享.成长,专注于原创专题案例,以最易学习编程的方式分享知识,让自己和他人都能有所收获.目前已完成的专题有:Netty4.x实战专题案例.用J ...

  6. java 字符串第一个字符_深入Java源码剖析之字符串常量

    字符串在Java生产开发中的使用频率是非常高的,可见,字符串对于我们而言非常关键.那么从C语言过来的同学会发现,在C中是没有String类型的,那么C语言要想实现字符串就必须使用char数组,通过一个 ...

  7. java字符串用0X0F分割_微信公众帐号开发教程第4篇-----开发模式启用及接口配置Java...

    创建一个Java Web工程,命名任意, 代码如下 1 package com.javen.course.servlet; 2  3 import java.io.IOException; 4 imp ...

  8. 以下描述java字符串错误的是_浙江理工大学java题库

    private protected private? protected public 40.声明成员变量时,如果不使用任何访问控制符(public, protected, private),则以下哪 ...

  9. java 反射 方法 修饰符_超类中使用默认修饰符的Java反射访问方法

    Method method = getClass().getSuperclass().getDeclaredMethod("doSomething"); method.invoke ...

最新文章

  1. private关键字和构造方法
  2. axure类型app项目rp文件_Python编程快速上手实践项目--选择性拷贝指定类型文件到目的目录...
  3. ionic集成jPush极光推送
  4. where does default 20 come from SAP UI5 growingThreshold
  5. HTML DOM之节点操作方法(1)
  6. 网页内置html5游戏,爽爆HTML5网页游戏!教你怎么精选浏览器
  7. OpenJ_Bailian 4017 爬楼梯
  8. mysql按字段拆分表_MYSQL命令怎么实现将表中某个字段中多个记录拆分,急求答案!...
  9. pytorch迁移学习后使用微调策略再次提高模型训练结果
  10. MobaXterm连接Linux教程
  11. mysql存储特殊表情符号_解决mysql存储特殊文字(表情符号)utf8mb4-阿里云开发者社区...
  12. C/C++中的 void*
  13. 【R】【课程笔记】04+05 数据预处理+收益率计算
  14. Bandwagon centos 6 32位配置SVN,apache,mysql和php
  15. 能骗173万的诈骗电话可以做到多逼真?
  16. linux rescue 黑屏,linux援救模式:linux rescue使用详细图解
  17. android相框_如何将旧的Android平板电脑变成自动更新的数码相框
  18. 屏幕录制软件camtasia studio 8序列号激活
  19. 何海涛——《剑指Offer:名企面试官精讲典型编程题》一书中IT名企经典面试题
  20. 工业品牌软文营销拒绝知识的禁锢需掌握这7种写作方法

热门文章

  1. SeismicUnix:wtlib.c[小波变换库]
  2. 将Fortran程序转化成大写[cwp]
  3. mfc编程vc6.0实现进程的创建和通信_免费送书:windows黑客编程技术详解
  4. Hibernate常见面试题
  5. java怎么查问题,java线上问题排查(日志、资源、代码定位)
  6. python数据分析的应用场景_第一章Python数据分析概述
  7. 深度学习多模态融合_多模态深度学习:用深度学习的方式融合各种信息
  8. jquery读取json文件跨域_跨域方法的若干种方式
  9. python自定义配置文件读取_python读取和自定义配置文件的方法
  10. 你的Unity3d代码质量还可以提高200%