Hi,

I am trying to start my application using Command Line Arguments but my application fail to build because of the params not beeing resolved by the arguments. I have tried using a profile in my pom.xml file with no success - I now need help as I think there is an error with the command in this Spring Boot version.

Good to know: Spring Boot version= 2.2.4 Java version= 11 Git Bash (where command is run) version= 2.35.1.windows.2

Here is my long command (with hidden values because of secrecy).

$ mvn spring-boot:run -Dspring-boot.run.arguments="--app.log.level=value --datasource.sjukofrisk.jdbcUrl=value --datasource.sjukofrisk.username=value --datasource.sjukofrisk.password=value --datasource.sjukofrisk.driverClassName=value --af.environment.header=value --x500.person.api.endpoint=value --x500.persons.api.endpoint=value --x500.person.api.client.id=value --x500.person.api.client.secret=value --sscfil.api.endpoint=value -sscfil.api.client.id=value --sscfil.api.client.secret=value --notifiering.sandare.api.endpoint=value --notifiering.sandare.api.client.id=value --notifiering.sandare.api.client.secret=value --robot.job.enable=value --ssc.fil.job.enable=value --datasource.afutil.jdbcUrl=value --datasource.afutil.username=value --datasource.afutil.password=value --ssc.fil.skickaklockslag=value --job.trigger.properties.cron-ssc-filoverforing-jobb=value --job.trigger.properties.cron-ssc-robot-arende-jobb=value --job.trigger.properties.cron-atgards-lista-jobb=value"

Here is my application.properties (the values to be populated. A bunch of others are hard-coded.)

app.log.level=${LOG_LEVEL}

notifiering.sandare.api.endpoint=${NOTIFICATION_SENDER_ENDPOINT}
notifiering.sandare.api.client.id=${NOTIFICATION_SENDER_CLIENT_ID}
notifiering.sandare.api.client.secret=${NOTIFICATION_SENDER_SECRET}

datasource.sjukofrisk.jdbcUrl=${SJUKOFRISK_JDBC_DATASOURCE}
datasource.sjukofrisk.username=${SJUKOFRISK_DATASOURCE_USERNAME}
datasource.sjukofrisk.password=${SJUKOFRISK_DATASOURCE_PASSWORD}
datasource.sjukofrisk.driverClassName=${SJUKOFRISK_DATASOURCE_DRIVER}
datasource.afutil.jdbcUrl=${AFUTIL_JDBC_DATASOURCE}
datasource.afutil.username=${AFUTIL_DATASOURCE_USERNAME}
datasource.afutil.password=${AFUTIL_DATASOURCE_PASSWORD}

x500.person.api.endpoint=${X500_PERSON_ENDPOINT}
x500.persons.api.endpoint=${X500_PERSONS_ENDPOINT}
x500.person.api.client.id=${X500_PERSON_CLIENT_ID}
x500.person.api.client.secret=${X500_PERSON_CLIENT_SECRET}
af.environment.header=${AF_ENVIROMENT_HEADER}

sscfil.api.endpoint=${SSC_FILE_JOB_ENDPOINT}
sscfil.api.client.id=${SSC_FILE_JOB_CLIENT_ID}
sscfil.api.client.secret=${SSC_FILE_JOB_CLIENT_SECRET}

ssc.fil.job.enable=${SSC_FILE_JOB_ENABLED}
robot.job.enable=${SSC_ROBOT_JOB_ENABLED}
ssc.fil.skickaklockslag=${SSC_FIL_SKICKA_TOM_KLOCKSLAG:false}

job.trigger.properties.cron-ssc-filoverforing-jobb=${SSC_FIL_JOBB_CRON_TRIGGER}
job.trigger.properties.cron-ssc-robot-arende-jobb=${ROBOT_ARENDE_JOBB_CRON_TRIGGER}
job.trigger.properties.cron-atgards-lista-jobb=${ATGARDS_LISTA_JOBB_CRON_TRIGGER}

Error message in logs:

Exception in thread "main" java.lang.IllegalStateException: Logback configuration error detected: ERROR in ch.qos.logback.core.joran.spi.Interpreter@8:64 - RuntimeException in Action for tag [springProperty] java.lang.IllegalArgumentException: Could not resolve placeholder 'LOG_LEVEL' in value "${LOG_LEVEL}"

Comment From: bclozel

Spring Boot 2.2.x is out of OSS support - can you reproduce the issue with a currently supported version? If so, could you share a minimal application that reproduces the problem? Thanks!

Comment From: dumontwatches

We have a monolith of an application so to update Spring Boot version means updating a lot of other dependencies and faceing many other error messages.

Back in the day that 2.2.X was OSS supported the Command Line Arguments were supported, how come they don't work anymore?

Comment From: wilkinsona

As far as we know, they do work. Unfortunately we cannot justify spending time diagnosing a problem with 2.2.x as it is no longer supported. Even if we found a bug, the earliest version it which it could be fixed is 2.6.x. If you are interested in support for using an older version of Spring Boot, commercial support is available for 2.4.x and later.

I would double-check that your application's main method is passing its args into the SpringApplication that it creates. If that doesn't help and you'd like further assistance, please follow up on Stack Overflow or Gitter providing a complete yet minimal example of the problem. If you would like further help here as you believe you have found a bug, please upgrade to 2.6.x or later and provide a sample. We can then re-open the issue and take another look.