At least in my case, what I noticed was this:- I was trying to run my application jar via the "java -jar" command on ec2 terminal. Eg:-
java -DMAIL_PASSWORD=abcd -DMAIL_USERNAME="[email protected]" -jar cardservices-1.0.0.jar &
and it started failing with the following error:- java.lang.IllegalArgumentException: Could not resolve placeholder 'MAIL_USERNAME' in value "${MAIL_USERNAME}"
Reason I found after I looked closely, pasting the above command on my notepad++ and enabling "Show all characters" and I could see that what appeared to be a space before "-DMAIL_USERNAME" was "NBSP". "NBSP" means non-breaking-space.
The issue with a non-breaking space (NBSP) is a subtle but common problem when copying and pasting commands into terminals. Non-breaking spaces (\u00A0) are invisible to the naked eye but are not treated as regular spaces (\u0020) by the shell, causing parameters to be misinterpreted.