springboot第8集:示例代码案例详细解释内容
controller.TestController
@RestController // 将数据以json形式返回
public classTestController {@GetMapping("/test")public String test() {return "hello <https://github.com/webVueBlog/JavaGuideInterview>"}
}
集成热部署并配置多环境和sql日志






创建数据库以及表





点击【终端】,登录root帐号,根据系统运行命令安装maven。
apt-get install maven
或者
yum install maven
解压到宝塔面板/www/wwwroot目录。

打开【终端】,运行cd命令进入项目目录的server目录,运行编译命令。首次编译需要下载依赖,时间会比较长。
cd /www/wwwroot/xxx/server
mvn clean install -Dmaven.test.skip=true -f pom.xml


点击【设置】-【伪静态】,填写下面伪静态信息,【保存】。
location / {try_files $uri $uri/ /index.html;
}

点击【SSL】-【Let's Encrypt】,选择【文件验证】,勾选域名,点击【申请】,等待完成https证书申请。


PC端和手机端
# 请将伪静态规则或自定义NGINX配置填写到此
location /pc {try_files $uri $uri/ /pc/index.html;
}location /mobile {try_files $uri $uri/ /mobile/index.html;
}
点击【SSL】-【Let's Encrypt】,选择【文件验证】,勾选域名,点击【申请】,等待完成https证书申请。
如果该产品有PC端网页前台访问:https://添加的前台域名/pc,即可访问PC端。如果该产品有手机网页端前台访问:https://添加的前台域名/mobile,即可访问PC端。默认访问域名,会自动根据访问者使用PC或手机自动跳转。
仓库地址:https://github.com/webVueBlog/JavaGuideInterview