陈云的子女,heatseek,屈玥个人资料
StaticProperties.class
@Component public class StaticProperties { public static String CUSTOM_NAME; @Value("${custom.name}") public void setCustomName(String customName) { CUSTOM_NAME = customName; } }
resources/META-INF/spring-configuration-metadata.json
{ "properties": [ { "name": "custom.name", "type": "java.lang.String", "sourceType": "com.anoyi.xxx.config.StaticProperties" } ] }
application.properties
custom.name=anoyi
至此,即可在 Spring Boot 全局任意引用 StaticProperties.CUSTOM_NAME
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
浅析我对 String、StringBuilder、StringBuffer 的理解
使用IDEA搭建SSM框架的详细教程(spring + springMVC +MyBatis)
Springboot整合freemarker 404问题解决方案
引入mybatis-plus报 Invalid bound statement错误问题的解决方法
网友评论