小编esc*_*ort的帖子

引起:java.io.FileNotFoundException: 类路径资源 [application.properties] 无法打开,因为它不存在

我正在创建一个 Spring Boot Batch 应用程序。该批次从 postgres 加载数据并插入到 MongoDB 中。我已经编写了代码,但是在运行 spring boot 应用程序时,它显示application.properties找不到文件的错误。以下是错误片段:

'Caused by: java.io.FileNotFoundException: class path resource [application.properties] cannot be opened because it does not exist'
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to parse configuration class [com.example.batch.SpringBatchExample]; nested exception is java.io.FileNotFoundException: class path resource [application.properties] cannot be opened because it does not exist
Run Code Online (Sandbox Code Playgroud)

以下是application.properties文件内容:

spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=Test_Data

#logging
logging.level.org.springframework.data=DEBUG
logging.level.=ERROR
logging.level.com.mastercard.refdata.*=DEBUG


#By default, Spring runs all the job as soon as it has started its context.
spring.batch.job.enabled=false

#Chunk Size …
Run Code Online (Sandbox Code Playgroud)

spring spring-batch spring-boot

8
推荐指数
3
解决办法
4万
查看次数

标签 统计

spring ×1

spring-batch ×1

spring-boot ×1