• SpringBoot配置SSLUnable to start ServletWebServerApplicationContext due to multiple ServletWebServerFa


    SpringBoot配置SSL后出现如下错误:

    Unable to start ServletWebServerApplicationContext due to multiple ServletWebServerFactory beans : webServerFactory,servletContainer

    完整报错:

    org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to multiple ServletWebServerFactory beans : webServerFactory,servletContainer
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.4.2.jar:2.4.2]
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:582) ~[spring-context-5.3.3.jar:5.3.3]
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.2.jar:2.4.2]
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) [spring-boot-2.4.2.jar:2.4.2]
    	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.4.2.jar:2.4.2]
    	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) [spring-boot-2.4.2.jar:2.4.2]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) [spring-boot-2.4.2.jar:2.4.2]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311) [spring-boot-2.4.2.jar:2.4.2]
    	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) [spring-boot-2.4.2.jar:2.4.2]
    	at ..main(.java:21) [classes/:na]
    Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to multiple ServletWebServerFactory beans : webServerFactory,servletContainer
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:214) ~[spring-boot-2.4.2.jar:2.4.2]
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:179) ~[spring-boot-2.4.2.jar:2.4.2]
    	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:159) ~[spring-boot-2.4.2.jar:2.4.2]
    	... 9 common frames omitted
    

    也就是由于多个ServletWebServerFactory bean,无法启动ServletWebServerApplicationContext,具体纠错过程不说了,解决步骤:

    1. 查看代码里是不是有多个TomcatConfig
    2. 查看入口函数是不是加了 TomcatServletWebServerFactory,去掉一个。解决。
     
    一、一对多(@OneToMany)1、单向一对多模型假设通过一个客户实体可以获得多个地址信息。对于一对多的实体关系而言,表结构有两种设计策略,分别是外键关联和表关联。(1) 映射策略---外键关联在数据库中表customer和表结构address定义,如下:
     
    1
    create table customer (  id int(20) not null auto_increment,  name varchar(100),  primary key(id))create table address (  id int(20) not null auto_increment,  province varchar(50),  city varchar(50),  postcode varchar(50),  detail varchar(50),  customer_id int(20),  primary key (id)) 
    注意此时外键定义在多的一方,也就是address表中。
  • 相关阅读:
    系统安全
    导出csv文件示例
    MsChart在MVC下的问题
    记录一些测试的结果
    使用CTE减少统计子查询
    otl获得sql出错位置(oracle)
    在sql语句中使用plsql变量
    Java经典编程题50道之二十四
    Java经典编程题50道之二十三
    Java经典编程题50道之二十二
  • 原文地址:https://www.cnblogs.com/mryaohu/p/15057708.html
Copyright © 2020-2023  润新知