侧边栏壁纸
  • 累计撰写 793 篇文章
  • 累计创建 1 个标签
  • 累计收到 1 条评论
标签搜索

目 录CONTENT

文章目录

https

Dettan
2020-12-27 / 0 评论 / 0 点赞 / 212 阅读 / 1,796 字
温馨提示:
本文最后更新于 2020-12-27,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

https

  • 要上的话全站都上,springBoot 配置好直接只开443接口
  • 可以开两个接口,支持http 和 https

keytool -genkeypair -alias tomcat_https -keypass 123456 -keyalg RSA -keysize 1024 -validity 365 -keystore d:/tomcat_https.keystore -storepass 123456

@SpringBootApplication
@EnableJpaRepositories(basePackages = {"com.pw.vmp.repository"}, repositoryBaseClass = GenericDaoImpl.class)
@EntityScan("com.pw.vmp.model")
@EnableConfigurationProperties({CasConfig.class, CompanyConfig.class})
public class VMPApplication {

    public static void main(String[] args) {
        SpringApplicationBuilder builder = new SpringApplicationBuilder(VMPApplication.class);
        builder.headless(false).run(args);
//		SpringApplication.run(VMPApplication.class, args);
    }

    @Bean
    public ServletWebServerFactory servletContainer() {
        TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
        tomcat.addAdditionalTomcatConnectors(createStandardConnector());
        return tomcat;
    }

    private Connector createStandardConnector() {
        Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
        connector.setPort(8090);
        return connector;
    }

    @Bean
    public RestTemplate restTemplate() {
        SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
        requestFactory.setConnectTimeout(10000);
        requestFactory.setReadTimeout(10000);
        RestTemplate restTemplate = new RestTemplate(requestFactory);
        return restTemplate;
    }
}
server:
  port: 443
  servlet:
    context-path: /vmp
  ssl:
    enabled: true
    key-store: classpath:tomcat_https.keystore
    key-store-type: JKS
    key-alias: tomcat_https
    key-password: 123456
    key-store-password: 123456
0

评论区