I am creating an spring boot Batch application. That Batch loads data from postgres and insert into MongoDB. I have written the code , but while running the spring boot application, its shows error that application.properties
file is not found. below are error snippets:
'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
Below are application.properties
file contents:
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 to save data
spring.chunk.size=200
#Postgres DATASOURCE
spring.datasource.url=jdbc:postgresql://localhost:5432/Company-Test
spring.datasource.username=postgres
spring.datasource.password=test123
spring.datasource.driver-class-name=org.postgresql.Driver
Please let me know why I am getting this issue??
application.properties
file is in your classpath. If you use maven, it should be insrc/main/resources
directory. – Creeper