Could not resolve placeholder 'com.example.application.auth.secret' in value "${com.example.applicat

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authenticatedUser' defined in URL [jar:file:/D:/Coding/JAVA/hilla-with-auth/target/hilla-with-auth-1.0-SNAPSHOT.jar!/BOOT-INF/c
lasses!/com/example/application/security/AuthenticatedUser.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'securityConfiguration': Injection of autowired dependencies 
failed
...
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfiguration': Injection of autowired dependencies failed
...
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'com.example.application.auth.secret' in value "${com.example.application.auth.secret}"

Only happens when running as jar, otherwise this error is not present (when running from the IDE, in dev mode).

Did a quick inspection of the jar and the secret is not found anywhere in it, so the error makes sense I guess.

You have to provide it to your application.

so create a application.properties file containing the secret next to the jar file?

Yeah

Or you can provide it as an environment variable or system property if you don’t want to hard-code it in the jar IIRC