zoukankan      html  css  js  c++  java
  • SpringCloud踩坑日记

        springboot项目jar包方式启动通用

      1.证书放入资源文件夹

      

       2.server 添加 ssl配置

      

           踩坑点: key-store: classpath后面的冒号需要紧跟着classpath,不能有空格,  这里我折腾了1个小时多才发现

       

         3.  原有http访问跳转到https

        

       @Bean
        public Connector connector(){
          
         //此函数中的80、443端口仅测试使用。 实际情况可读取配置后修改 
         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; }

      

         

           

      

      

      

  • 相关阅读:
    欧拉公式求四面体的体积
    欧拉公式求四面体的体积
    I
    I
    闭包传递(floyed)
    闭包传递(floyed)
    Python hypot() 函数
    Python cos() 函数
    Python atan2() 函数
    Python atan() 函数
  • 原文地址:https://www.cnblogs.com/xdxy/p/9962634.html
Copyright © 2011-2022 走看看