惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

TaoSecurity Blog
TaoSecurity Blog
T
Troy Hunt's Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Vercel News
Vercel News
T
Threatpost
G
Google Developers Blog
T
Threat Research - Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
T
The Exploit Database - CXSecurity.com
H
Heimdal Security Blog
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss
Know Your Adversary
Know Your Adversary
Hacker News: Ask HN
Hacker News: Ask HN
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Schneier on Security
B
Blog
V2EX - 技术
V2EX - 技术
NISL@THU
NISL@THU
C
CERT Recently Published Vulnerability Notes
W
WeLiveSecurity
C
Cybersecurity and Infrastructure Security Agency CISA
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Y
Y Combinator Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Spread Privacy
Spread Privacy
The Last Watchdog
The Last Watchdog
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
Schneier on Security
Schneier on Security
F
Fortinet All Blogs
N
News | PayPal Newsroom
Attack and Defense Labs
Attack and Defense Labs
Blog — PlanetScale
Blog — PlanetScale
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Microsoft Security Blog
Microsoft Security Blog
S
Security @ Cisco Blogs
人人都是产品经理
人人都是产品经理
爱范儿
爱范儿
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
Project Zero
Project Zero
I
Intezer
罗磊的独立博客
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
SecWiki News
SecWiki News
Martin Fowler
Martin Fowler

博客园 - 光脚码农

CentOS安装JDK CentOS 7中安装和配置Promethues - 光脚码农 - 博客园 查看和指定SpringBoot内嵌Tomcat的版本 - 光脚码农 - 博客园 CentOS中安装Azkaban 2.5 Centos7 安装Nodejs SQL实用札记【SQL Sever篇】 话说静态构造函数 如何利用正则表达式匹配花括号内的内容 如何为Windows Forms应用程序添加启动参数(Start-Up Parameters) 利用存储过程来重命名SQL Server数据库 .NET批量操作窗口样式 ViewData、ViewBag、TempData、Session的区别与联系 如何为自己的网页实现一个“回到顶部”的链接? 如何获得数据库中所有用户创建的索引 如何为一个类型为Color的属性设置默认值 用BCP从SQL Server 数据库中导出Excel文件 DataGridView如何绑定DataRow对象集合 Const vs. Readonly Windows下Git的安装与配置(Cygwin)
SpringBoot实用技巧札记
光脚码农 · 2017-05-04 · via 博客园 - 光脚码农

目录

  1. 如何手工设置SpringBoot内嵌的Tomcat启动端口号(port)
  2. 如何解决Eclipse.Properties中文乱码的问题

如何手工设置SpringBoot内嵌的Tomcat启动端口号(port)

实现此需求的方法有好几种:

  • 直接修改application.properties (/src/main/resources/),增加Tomcat端口号设定。 
    # 特定端口号
    server.port = 8090
    # 随机可用端口号
    server.port = 0
  • 通过修改VM的参数来实现。以IDEA为例子,可以直接去Run -> Edit Configurations -> VM options

  • 或直接在代码中编程实现
    // 方法1: 
    @Controller
    public class ServletConfig {
        @Bean
        public EmbeddedServletContainerCustomizer containerCustomizer() {
            return (container -> {
                container.setPort(8012);
            });
        }
    }
    
    // 方法2:
    HashMap<String, Object> props = new HashMap<>();
    props.put("server.port", 9999);
    
    new SpringApplicationBuilder()
        .sources(SampleController.class)                
        .properties(props)
        .run(args); 
  • 参考资料

如何解决Eclipse.Properties中文乱码的问题

解决此问题的方法分几种:

1. 修改properties文件的编码
  1. 右键点击该所在项目,点击properties
  2. 在出现的界面选择info
  3. 更改里面的text file encoding,选择other:utf-8,点击确定。