参考来源:https://www.cnblogs.com/imfjj/p/9058443.html

https://blog.csdn.net/jackymvc/article/details/81077885

配置证书:

keytool -genkeypair -alias tomcat -keyalg RSA -keystore tomcat.key

依次填入以下内容:

mcat.key
输入密钥库口令:
再次输入新口令:
您的名字与姓氏是什么?
[Unknown]: localhost
您的组织单位名称是什么?
[Unknown]: localhost
您的组织名称是什么?
[Unknown]: xxx Co,.Ltd
您所在的城市或区域名称是什么?
[Unknown]: KunShan
您所在的省/市/自治区名称是什么?
[Unknown]: SuZhou
该单位的双字母国家/地区代码是什么?
[Unknown]: China
CN=localhost, OU=localhost, O="xxxCo,.Ltd", L=KunShan, ST=SuZhou, C=Chin
a是否正确?
[否]:y 输入 <tomcat> 的密钥口令
(如果和密钥库口令相同, 按回车):
再次输入新口令:

把生成的证书放入 resources目录

配置application.yml

debug: true
server:
port:
tomcat:
max-threads:
accept-count:
min-spare-threads:
max-connections:
ssl:
key-store: classpath:tomcat.key
key-store-type: JKS
key-alias: tomcat
#证书密码
key-store-password: xxxx

中途遇到报错:

-- ::49.752 default [main] DEBUG o.s.b.d.LoggingFailureAnalysisReporter - Application failed to start due to an exception
org.springframework.boot.web.embedded.tomcat.ConnectorStartFailedException: Connector configured to listen on port failed to start
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.checkThatConnectorsHaveStarted(TomcatWebServer.java:)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.jrLockAndRefresh(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at com.xxx.web.WebApplication.main(WebApplication.java:)
-- ::49.752 default [main] ERROR o.s.b.d.LoggingFailureAnalysisReporter -

解决方法:

参考来源:Spring Boot- The Tomcat connector configured to listen on port 8080 failed to start

SpringBoot 2.x

新增一个组件类


@Component
public class CustomContainer implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> { @Value("${server.port}")
int serverPort; @Override
public void customize(ConfigurableServletWebServerFactory factory) {
factory.setPort(serverPort);
}
}

 

SpringBoot 1.x解决方法:

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.stereotype.Component; @Component
public class CustomContainer implements EmbeddedServletContainerCustomizer { @Override
public void customize(ConfigurableEmbeddedServletContainer container) { container.setPort(8085); } }

SpringBoot 2.x中为tomcat配置ssl(https)支持的更多相关文章

  1. apache Tomcat配置SSL(https)步骤

    Tomcat配置https 1      生成Server端安全证书 要实现通信加密,首先要在本地准备一份符合X.509标准的Server端安全证书.如果有条件的话,可以向权威CA申请一份经过认证的安 ...

  2. linux apache Tomcat配置SSL(https)步骤

    https简介 它是由Netscape开发并内置于其浏览器中,用于对数据进行压缩和解压操作,并返回网络上传送回的结果.HTTPS实际上应用了Netscape的安全套接字层(SSL)作为HTTP应用层的 ...

  3. windows 下nginx配置ssl https支持

    本文适合正式上线的配置,购买来的证书 私钥*.key文件需要先去掉密码 openssl rsa -in old.key -out new.key

  4. Springboot 配置 ssl 实现HTTPS 请求 & Tomcat配置SSL支持https请求

    SSL(Secure Sockets Layer 安全套接层),及其继任者传输层安全(Transport Layer Security,TLS)是为网络通信提供安全及数据完整性的一种安全协议.TLS与 ...

  5. TOMCAT配置SSL认证为HTTPS协议服务

     1 . 问题概述 很多安全性要求较高的系统,都会使用安全套接字层(SSL)进行信息交换, Sun为了解决在Internet上的实现安全信息传输的解决方案.它实现了SSL和TSL(传输层安全)协议 ...

  6. 单点登录 SSO, 自动登录 , java 加密,ssl原理, Tomcat配置SSL

    韩梦飞沙  韩亚飞  313134555@qq.com  yue31313  han_meng_fei_sha 单点登录的英文简称为SSO(single sign on),单点登录功能使得用户只要登录 ...

  7. Nginx和Tomcat配置SSL实现https访问

    环境:CentOS 7 Nginx版本: nginx/1.18.0 1. 安装nginx 详细步骤可以参考如下官网:http://nginx.org/en/linux_packages.html#RH ...

  8. 华为云服务器为Tomcat配置SSL

    近期由于开发小程序需要在云服务器上配置https访问协议,也遇到了一点小问题,把配置过程记录一下:SSL 证书申请下来之后会有 .jks .crt .pfx .pem为后缀的文件(如何申请SSL证书这 ...

  9. Tomcat配置SSL

    Tomcat配置SSL 查询网上资料配置如下: <Connector port="8443" protocol="HTTP/1.1" maxThreads ...

随机推荐

  1. 机器学习 三剑客 之 pandas + numpy

    机器学习 什么是机器学习? 机器学习是从数据中自动分析获得规律(模型),并利用规律对未知数据进行预测 机器学习存在的目的和价值领域? 领域: 医疗.航空.教育.物流.电商 等... 目的: 让机器学习 ...

  2. Java&Selenium根据实参启动相应浏览器

    Java&Selenium根据实参启动相应浏览器 /** * 定义函数initBrowser * @param browser:字符串参数chrome/ie/xx * @return 并返回驱 ...

  3. python画图matplolib

    http://python.jobbole.com/85106/ 1.画二维图 2.画三维图 我的电脑只能在jupyter notebook上面运行才能看的到,常规import库 %matplotli ...

  4. css引用优先级

    /***************************************css注意事项*******************************************/ 浏览器优先级:设 ...

  5. SqlHelper发布—比Pagehelper更好用的分页插件

    SqlHelper发布-比PageHelper性能更高 起源 前段时间开启了一个新的项目,在选择分页插件时,发现github上很流行的一个是pagehelper,在百度上搜索了一下,使用量.由于项目紧 ...

  6. winfrom 窗体首次加载

    #region Override Functions /// <summary> /// OnLoad /// </summary> /// <param name=&q ...

  7. list,tuple,set,dict基础

    list # @Auther : chen # @Time : 2018/4/26 19:55 # @File : list_ex.py # @SoftWare : PyCharm # list1 = ...

  8. mysql查看查询缓存是否启用

    查看查询缓存情况: mysql> show variables like '%query_cache%';  (query_cache_type 为 ON 表示已经开启) +---------- ...

  9. python if else elif statement

    name = input('what is your name?')if name.endswith('zd'): print("hello panzidong") name = ...

  10. leetcode解题报告(11):Search Insert Position

    描述 Given a sorted array and a target value, return the index if the target is found. If not, return ...