第三节:SpringBoot使用properties配置文件实现多环境配置
来源:互联网 发布:网游数据提取 编辑:程序博客网 时间:2024/05/17 17:38
application.properties配置文件如下
#配置属性占位符xiaowen.name="xiaowen"xiaowen.desc=${xiaowen.name} is successfully#配置tomcat端口server.port=8088#激活pplication-dev.properties配置文件spring.profiles.active=dev
xiaowen.age=18
package com.xiaowen.controller;import java.util.HashMap;import java.util.Map;import org.springframework.beans.factory.annotation.Value;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestControllerpublic class WebController {@Value("${xiaowen.name}")private String name;@Value("${xiaowen.desc}")private String desc;@Value("${xiaowen.age}")private int age;@RequestMapping("/index")public Map<String, Object> Index(){Map<String, Object> map=new HashMap<String, Object>();map.put("name", name);map.put("desc", desc);map.put("age", age);return map; }}浏览器访问http://localhost:8088/index
阅读全文
1 0
- 第三节:SpringBoot使用properties配置文件实现多环境配置
- SpringBoot 使用properties配置文件实现多环境配置
- Spring Boot系列教程五:使用properties配置文件实现多环境配置
- Spring Boot系列教程五:使用properties配置文件实现多环境配置
- springboot学习总结系列(一):多环境下(开发环境,生产环境)使用yml 或 properties 配置文件
- SpringBoot ——配置文件多环境配置
- springboot配置文件application.properties中的配置项
- 第三节·配置服务器JAVA环境
- springBoot配置文件application.properties
- SpringBoot 配置文件 application.properties
- Springboot配置文件之properties
- 【SpringBoot教程三】:配置文件和多环境配置
- springboot多环境配置
- Springboot的配置文件Application.properties
- application.properties详解 --springBoot配置文件
- SpringBoot获取properties配置
- springboot-properties配置
- SpringBoot获取properties配置
- Android自定义View(一) 画线段
- javaScript学习-动态为ul添加li
- wince整体解决方案编译错误的解决办法(StdAfx.obj' not allowed with multiple source files )
- Android数据加密之Aes加密
- Android7.0 PowerManagerService(4) Power按键流程
- 第三节:SpringBoot使用properties配置文件实现多环境配置
- 解决报错:错误1130- Host xxx is not allowed to connect to this MariaDb server
- Java基础之四大内部类(结合代码理解)
- MVC框架
- Maven下安装oracle详细步骤
- Windows 2008 R2 DFS分布式文件系统配置
- 复习Java(五)猜测随机生成的数字Program
- Linux服务器上配置多个Tomcat
- ExtJS Grid Tooltip提示 鼠标悬停