Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
geek 72ffe33136 | 4 years ago | |
---|---|---|
.. | ||
.mvn/wrapper | 4 years ago | |
src | 4 years ago | |
.gitignore | 4 years ago | |
README.md | 4 years ago | |
pom.xml | 4 years ago | |
ssl.png | 4 years ago |
For further reference, please consider the following sections:
自己生成的证书浏览器会有危险提示,去ssl网站上使用金钱申请则不会
server:
ssl:
# 证书路径
key-store: spring-boot-demo-https\src\main\resources\server.keystore
key-alias: tomcat
enabled: true
key-store-type: JKS
#与申请时输入一致
key-store-password: 123456
# 浏览器默认端口 和 80 类似
port: 443
#debug: true
@Bean
public Connector connector(){
Connector connector=new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setScheme("http");
connector.setPort(80);
connector.setSecure(false);
connector.setRedirectPort(443);
return connector;
}
@Bean
public TomcatServletWebServerFactory tomcatServletWebServerFactory(Connector connector){
TomcatServletWebServerFactory tomcat=new TomcatServletWebServerFactory(){
@Override
protected void postProcessContext(Context context) {
SecurityConstraint securityConstraint=new SecurityConstraint();
securityConstraint.setUserConstraint("CONFIDENTIAL");
SecurityCollection collection=new SecurityCollection();
collection.addPattern("/*");
securityConstraint.addCollection(collection);
context.addConstraint(securityConstraint);
}
};
tomcat.addAdditionalTomcatConnectors(connector);
return tomcat;
}
一个用来深度学习并实战 spring boot 的项目,目前总共包含 66 个集成demo,已经完成 55 个。
Java SVG CSS JavaScript SQL other