/**
* Spring boot配置
*/
//1、生成jsk命令
keytool -importkeystore -srckeystore 读取绝对路径.pfx -destkeystore 存放的绝对路径.jks -srcstoretype PKCS12 -deststoretype JKS
//2、放到.yml配置文件同级目录下
//3、配置文件修改
server:
port: 443
ssl:
key-store: classpath:xxx.jks
key-store-password: 密码
key-alias: alias
key-store-type: JKS
//4、启动文件修改
@Bean
public TomcatServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
@Override
protected void postProcessContext(Context context) {
//如果不要http,就放开注释
// SecurityConstraint constraint = new SecurityConstraint();
// constraint.setUserConstraint("CONFIDENTIAL");
// SecurityCollection collection = new SecurityCollection();
// collection.addPattern("/*");
// constraint.addColle