=========================================================================================
读取数据并显示:
package org.example.controller; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class ValueReaderConfigController { @Value("${test.environment}") private String msg; // http://localhost:8080/testValue @RequestMapping("/testValue") public String testValue() { return "方法二:" + msg; } }
===============================================================================
标签:spring,boot,springframework,Value,testValue,org,import,annotation From: https://www.cnblogs.com/xiaobaibailongma/p/17018392.html