当前位置: 首页> 健康> 知识 > 工程公司有哪些职位_网页设计有啥教程_市场推广计划_微信推广怎么弄

工程公司有哪些职位_网页设计有啥教程_市场推广计划_微信推广怎么弄

时间:2025/9/29 1:39:52来源:https://blog.csdn.net/qq_45939907/article/details/146603776 浏览次数:0次
工程公司有哪些职位_网页设计有啥教程_市场推广计划_微信推广怎么弄

1、简介

在 SpringBoot 中,不同的环境(如开发、测试、生产)可以编写对应的配置文件,例如数据库连接信息、日志级别、缓存配置等。在不同的环境中使用对应的配置文件。

2、配置环境

# 开发环境
zbj:user:username: root
# 测试环境
zbj:user:password: 123456

3、激活环境

 4、测试

User类

package com.sgu.pojo;import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;/*** 满堂花醉三千客,一剑寒霜十四州。** @Author 中瑞* @Date 2025/3/28 14:25*/@Component
@ConfigurationProperties(prefix = "zbj.user")
@Data
public class User {private String username;private String password;private List<String> gfs;
}

UserController类

package com.sgu.controller;import com.sgu.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;/*** 满堂花醉三千客,一剑寒霜十四州。** @Author 中瑞* @Date 2025/3/28 14:26*/@RestController
@RequestMapping("/user")
public class UserController {@Autowiredprivate User user;@GetMapping("/show")public User show() {return user;}
}

启动项目,浏览器输入地址:

http://127.0.0.1:8080/user/show

 5、参考

146-springboot-多环境配置和激活_哔哩哔哩_bilibili

关键字:工程公司有哪些职位_网页设计有啥教程_市场推广计划_微信推广怎么弄

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: