Exception Spring单元测试@ContextConfiguration

Exception Spring单元测试@ContextConfiguration,exception,junit,spring-batch,Exception,Junit,Spring Batch,我正在使用@ContextConfiguration注释在spring批处理应用程序的单元测试中加载我的应用程序上下文。 应用程序上下文使用属性及其值指定bean。这些值是从属性文件中读取的。因此,用于值的语法是${a.b:default}。 运行junit时,出现以下错误: Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang

我正在使用@ContextConfiguration注释在spring批处理应用程序的单元测试中加载我的应用程序上下文。 应用程序上下文使用属性及其值指定bean。这些值是从属性文件中读取的。因此,用于值的语法是${a.b:default}。 运行junit时,出现以下错误:

Caused by: org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'xyz'; nested exception is java.lang.NumberFormatException: For input string: "${a.b:50}"

批处理作业本身运行良好。我只在junit中看到这个问题。

您的测试是否使用与工作批处理相同的Springbean配置?看起来PropertyPlaceHolderConfigure不工作或不存在