zoukankan      html  css  js  c++  java
  • 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表中。
  • 相关阅读:
    mysql表的查询(连接查询)练习
    mysql基础语法
    Linux 常用命令整理
    1.django 环境搭建
    2.django 操作笔记
    mysql基础笔记(1)
    VMware复制Linux虚拟机后网络配置
    uC/OS-III 软件定时器(三)
    uC/OS-III 时间管理(二)
    uC/OS-III 时钟节拍(一)
  • 原文地址:https://www.cnblogs.com/mryaohu/p/15057708.html
Copyright © 2011-2022 走看看