SpringBoot配置启动页(首页)控制台打印项目访问入口url
一、SpringBootApplication
1 package com.reliable.yang;
2
3 /**
4 * @author Administrator
5 * @date 2022-06-20 16:32
6 */
7 import lombok.extern.slf4j.Slf4j;
8 import org.springframework.boot.SpringApplication;
9 import org.springframework.boot.autoconfigure.SpringBootApplication;
10 import org.springframework.context.ConfigurableApplicationContext;
11 import org.springframework.core.env.Environment;
12 import org.springframework.util.StringUtils;
13
14 import java.net.InetAddress;
15 import java.net.UnknownHostException;
16 @Slf4j
17 @SpringBootApplication
18 public class BlogApp {
19 public static void main(String[] args) throws UnknownHostException, UnknownHostException {
20 ConfigurableApplicationContext application = SpringApplication.run(BlogApp.class, args);
21 log.info("..######..##.....##..######...######..########..######...######.\n" +
22 ".##....##.##.....##.##....##.##....##.##.......##....##.##....##\n" +
23 ".##.......##.....##.##.......##.......##.......##.......##......\n" +
24 "..######..##.....##.##.......##.......######....######...######.\n" +
25 ".......##.##.....##.##.......##.......##.............##.......##\n" +
26 ".##....##.##.....##.##....##.##....##.##.......##....##.##....##\n" +
27 "..######...#######...######...######..########..######...######.");
28 Environment env = application.getEnvironment();
29 String ip = InetAddress.getLocalHost().getHostAddress();
30 String port = env.getProperty("server.port");
31 String path = env.getProperty("server.servlet.context-path");
32 if (StringUtils.isEmpty(path)) {
33 path = "";
34 }
35 log.info("\n----------------------------------------------------------\n\t" +
36 "Application is running! Access URLs:\n\t" +
37 "Local访问网址: \t\thttp://localhost:" + "8080" + path + "\n\t" +
38 // "External访问网址: \thttp://" + ip + ":" + port + path + "\n\t" +
39 "----------------------------------------------------------");
40 }
41 }
二、application.properties
1 server.port= 8888
2 server.servlet.context-path=/
三、controller
1 @Controller
2
3 public class IndexController {
4 @RequestMapping("/")
5 public String homePage() {
6 return "login.html"; // login.html 需要在static目录下
7 }
8 }
效果如图:

参考:https://www.hangge.com/blog/cache/detail_2528.html
SpringBoot配置启动页(首页)控制台打印项目访问入口url的更多相关文章
- 将Web项目访问的URL项目名设置为"/"
工具:Eclipse 步骤: 1.鼠标右键项目名--->properties--->Web Project Setting--->Context root. 将Context roo ...
- [Swift]LaunchScreen.storyboard设置启动页
设置[General]->[App Icons and Launch Images] 注意:当App不是用LaunchScreen.xib来配置启动页时,[LaunchScreen File]置 ...
- 关于iOS启动页launchImage无法显示解决办法
在没有美工的时候,往往项目开发到一半,才拿到icon和launchImage图片,这时在添加对应图片之后发现并没有正常显示,这就蛋疼了,以下列出几种解决方式. 关于设置launchImage: 工程配 ...
- iOS开发-APP图标、启动页、名字的设置
APP图标.启动页.名字的设置:(较全面,但是APP启动页讲述的有漏洞) 参考链接:https://www.jianshu.com/p/2c7e181276ff APP启动页:(弥补上一文的漏洞) 参 ...
- IDEA springboot配置
基于springboot2.1.7 springboot项目创建 springboot热部署 springboot配置swagger2 springboot配置mybatis springboot配置 ...
- springboot配置redis+jedis,支持基础redis,并实现jedis GEO地图功能
Springboot配置redis+jedis,已在项目中测试并成功运行,支持基础redis操作,并通过jedis做了redis GEO地图的java实现,GEO支持存储地理位置信息来实现诸如附近的人 ...
- 【IOS】模仿"抽屉新热榜"动态启动页YFSplashScreen
IOS最好要设置系统默认启动页面,不然进入应用就会突然闪现黑色画面 下图是我们要实现的效果: 总体思路:设置一个系统默认启动页面,在进入didFinishLaunchingWithOptions时, ...
- 微信小程序之启动页的重要性
启动页在APP中是个很常见的需求,为什么对于小程序来说也非常重要呢?首先我描述一下我在开发过程中遇到的一些问题以及解决的步骤,到最后为什么要加启动页,看完你就明白了. 小程序的首页需要展示用户关注的小 ...
- maven项目整合SSM配置log4j, 实现控制台打印SQL语句
在原有项目正常启动的情况下, 实现在控制台打印mapper包下SQL语句. 1.在pom.xml配置文件中添加两个依赖(缺一不可) <!--日志包--> <dependency> ...
- 用Flutter开发的跨平台项目,完美运行在Android和IOS上,Material简洁风格,包括启动页、引导页、注册、登录、首页、体系、公众号、导航、项目,还有漂亮的妹子图库,运行极度流畅,结构清晰,代码规范,值得拥有
Flutter学习资源汇总持续更新中...... Flutter官方网站 Flutter中文网 wendux的Flutter实战 Flutter官方exampleflutter_gallery 阿里巴 ...
随机推荐
- nodejs+express4实现文件上传下载删除和列表展示功能
0.效果展示 1.创建项目 创建文件夹:express_file_upload npm init # 入口文件选择server.js 安装插件 npm install express npm inst ...
- zTree如何实现模糊查找实战
1.说明 最近在研究zTree树控件.过程中涉及到了实现模糊查找结点的功能,特此分享一下. 有关zTree的有关介绍和使用,请访问其官网:zTree -- jQuery 树插件 本文假设你已经比较熟悉 ...
- junit运行Parameterized参擞化测试
Parameterized (参数化)的测试运行器允许你使用不同的参数多次运行同一个侧试. 运行此测试的必备条件: 1.必须使用@RunWith(Parameterized.class) 2.必须声明 ...
- win32 - PeekNamedPipe的用法
PeekNamedPipe: 将数据从命名管道或匿名管道复制到缓冲区中,而不将其从管道中删除.它还返回有关管道中数据的信息. 示例: #include <iostream> #includ ...
- TCP/IP的确认号,序列号和超时重传的学习笔记
一:确认应答和序列号 在tcp中,发送端的数据到达主机时,接收端会返回一个已收到的通知.这个消息叫做确认应答(ACK). 当发送端发送数据后,会等待对端的确认应答.如果有确认应答,说明数据已经成功到达 ...
- 如何优化好UITableView,值得思考
如果你觉得 UITableViewDelegate 和 UITableViewDataSource 这两个协议中有大量方法每次都是复制粘贴,实现起来大同小异:如果你觉得发起网络请求并解析数据需要一大段 ...
- 用容器部署Nexus 3作为Nuget和Docker的仓库
1.准备docker-compose的配置文件 version: '3' services: nexus: image: 'sonatype/nexus3:3.42.0' container_name ...
- 浅入kubernetes(3):namespace、node、pod
目前已经完成三篇关于 kubernetes 的文章: 在 Ubuntu 上安装 K8S教程 浅入kubernetes(1):Kubernetes 入门基础 浅入kubernetes(2):Kubern ...
- X86模拟龙芯与编译 .NET CoreCLR
目录 .NET 收到一台龙芯机器 编译 CoreCLR 环境要求 部署虚拟机与环境 Linux 安装 KVM 下载需要的文件 启动模拟器 下载 CoreCLR 尝试编译 CoreCLR 前段时间得知龙 ...
- VC-MFC 在磁盘中读取文件
1 // ReadDlg.cpp : 实现文件 2 // 3 4 #include "stdafx.h" 5 #include "Read.h" 6 #incl ...