springboot 实现配置文件给常量赋值

@Component
@ConfigurationProperties(prefix = "task.cron")
public class TaskCronParam implements InitializingBean {
	private String testCron;

	public static String TEST_CRON;

	@Override
	public void afterPropertiesSet() throws Exception {
		TEST_CRON =testCron;
	}
}

posted on 2019-03-22 15:58  朱春旺  阅读(1289)  评论(0编辑  收藏  举报