参考来源: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. 目标检测 — two-stage检测

    目前主流的目标检测算法主要是基于深度学习模型,其可以分成两大类:two-stage检测算法:one-stage检测算法.本文主要介绍第一类检测算法,第二类在下一篇博文中介绍. 目标检测模型的主要性能指 ...

  2. C#中设置密码框 ,用符号代替密码

    添加控件 添加控件 确认键代码 private void button1_Click(object sender, EventArgs e) { //修改密码.新密码,重复新密码,两次输入的新密码必须 ...

  3. 【javascript】h5页面禁止返回上一页

    window.history.pushState("","","#"); window.addEventListener("pop ...

  4. less避免编译

    less里面有一个避免编译,有时候我们需要输出一些不正确的css语法或者使用less不认识的专有语法.要输出这样的值我们可以在字符串前加上一个~ /*避免编译*/ .test_03{ width: 3 ...

  5. windows下对socket的send和recv的超时设置,并附一个简洁明了的socket简单demo

    设置方法 int nNetTimeout=10000;//10秒,    //设置发送超时    setsockopt(m_socket,SOL_SOCKET,SO_SNDTIMEO,(char *) ...

  6. JS 禁用按钮10秒方法

    方式一:禁用10秒,10秒钟后可用 /** * 按钮禁用10秒 * @param submitButtonName 按钮ID名 */ function disabledSubmitButton(sub ...

  7. Linux使用帮助详解

    主要内容:                    whatis                    command --help                     man and info   ...

  8. Illegal mix of collations (utf8mb4_general_ci,IMPLICIT) and (utf8mb4_unicode_ci,IMPLICIT) for operation '<>'

    1.问题 今天又在mysql中遇到了,吐血. 2.解决方案 SQL最后加上 COLLATE utf8mb4_unicode_ci SELECT t2.cust_id as cust_id_ex,t1. ...

  9. jvm参考(生产使用)

    #4g JAVA_OPTS=-Xms3g -Xmx3g -XX:+PrintFlagsFinal -XX:+UnlockDiagnosticVMOptions -XX:NewRatio=2 -XX:P ...

  10. PHP mysqli_change_user() 函数

    改变指定数据库连接的用户: <?php $con=mysqli_connect("localhost","my_user","my_passwo ...