原文 :/kangkanglou/article/details/78585997
项目需要提供一个当前项目版本号的接口。直接获取 pom 文件中的版本号
步骤:
1、 文件
version=${}
2、类中
@Value("${version}")
private String version;
复制代码
但是:Caused by: : Could not resolve placeholder '' in value "${}"
我的 pom 文件:
解决:If you are using the spring boot parent pom the default placeholders have been re-configured to not conflict with the ${} syntax of spring itself.
To replace the maven properties use @ - so @@ instead of ${}.
filtering of the file is enabled by default.
文件
version=@@