实体类br/>@Configuration
@PropertySource(value="classpath:static/properties/bookshop.properties")br/>@ConfigurationProperties(prefix="com.tree")
public class TreeEntity {}br/>自定义properties文件
com.tree.treeName=\u767D\u6768\u6811
com.tree.treeHeight=60m
com.tree.diameter=2.2m
com.tree.color=Red
@RestController
@RequestMapping(value="/tree")
public class TreeController {

@Autowired
private TreeEntity treeEntity;

@RequestMapping(value="treedata",method=RequestMethod.GET)
public String getTreeData() {
    String retVal=treeEntity.toString();
    return retVal;
}

}
访问接口方法
http://localhost:8081/skcc/tree/treedata
https://www.fangzhipeng.com/springboot/2017/05/02/sb2-config-file.html