0

Previously everything worked properly. Today I configured Spring Batch together with my Spring Boot application and faced an issue with application.properties.

I have following properties encrypted with Jasypt:

spring.profiles.active=https
ENVIRONMENT=h2

#aws sqs
aws.sqs.account.access.key=ENC(kjsdh456fgkjhdfsgkjhdfg)
#queue message listener
queue.message.listener.task.executor.threads.number=1
queue.message.listener.task.executor.max.concurrent.consumers=1

Now, in order to configure Spring Batch I added

ENVIRONMENT=h2

to application.properties file.

also, I have added batch-h2.properties file:

# Placeholders batch.* for H2 database:
batch.jdbc.driver=org.h2.Driver
batch.jdbc.url=jdbc:h2:~/testdb;CIPHER=AES;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE
batch.jdbc.user=sa
batch.jdbc.password="sa sa"
batch.jdbc.testWhileIdle=false
batch.jdbc.validationQuery=
batch.drop.script=classpath:/org/springframework/batch/core/schema-drop-h2.sql
batch.schema.script=classpath:/org/springframework/batch/core/schema-h2.sql
batch.business.schema.script=classpath:/business-schema-h2.sql
batch.database.incrementer.class=org.springframework.jdbc.support.incrementer.H2SequenceMaxValueIncrementer
batch.database.incrementer.parent=sequenceIncrementerParent
batch.lob.handler.class=org.springframework.jdbc.support.lob.DefaultLobHandler
batch.grid.size=2
batch.jdbc.pool.size=6
batch.verify.cursor.position=true
batch.isolationlevel=ISOLATION_SERIALIZABLE
batch.table.prefix=BATCH_

and after that I continuously receiving following exception:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'aws.sqs.account.access.key' in string value "${aws.sqs.account.access.key}"

aws.sqs.account.access.key property now cannot be resolved.

I'm injecting this property into my configuration:

@Configuration
public class SQSConfig {

    @Value("${aws.sqs.account.access.key}")
    private String accessKey;

How to fix it ?

alexanoid
  • 24,051
  • 54
  • 210
  • 410

0 Answers0