这里写自定义目录标题
#使用Docker部署SpringBoot项目,加Https安全,SSL证书
###转载自
https://blog.csdn.net/qq_44331428/article/details/108403236
简书学习网址
https://www.jianshu.com/p/397929dbc27d
SpringBoot使用SSL
首先到阿里云申请一个免费的SSL证书
前往 阿里云SSL证书购买页面先选择 单个域名 > DV域名级SSL > 免费版 > DigiCert,如果不按照此提示选择可能无法找到免费证书。
下载证书,得到压缩包
将文件解压出来 将第一个文件移动到 项目的resource目录下
在启动类上添加
@Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint = new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection = new SecurityCollection();
collection.addPatt