如何在定义为 VM 选项的 maven 命令行中添加参数。在 Intellij 我有配置
java 11 -Djasypt.encryptor.password=xxx
当我在配置类中使用 @Value 注释读取 VM 选项时,该解决方案非常有效。
@Value("${jasypt.encryptor.password}")
private String jasyptEncryptorPassword;
我正在使用以下命令 mvn -Djasypt.encryptor.password=xx spring-boot:run 但它无法获取并出现以下错误。
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jasyptConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jasypt.encryptor.password' in value "${jasypt.encryptor.password}"
只有命令 java -jar 可以附加 VM 选项?