Spring Boot4-2 --嵌入式Servlet容器自动配置原理(Spring Boot版本2.1.3)(理解原理)

本文深入探讨Spring Boot2.1.3中嵌入式Servlet容器如Tomcat的自动配置原理,包括ServletWebServerFactoryConfiguration、ServletWebServerFactoryAutoConfiguration和ServletWebServerFactoryCustomizer的角色。分析了如何通过配置文件和定制器对Servlet容器进行修改和定制,详细阐述了从启动到配置的过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

springBoot 默认使用的是tomcat
在导入的依赖中:autoconfigure 中的web 目录下所有含有Server的类都与Servlet容器的相关
笔记的原理分析基于Spring Boot2.1.3版本;2.0 以下版本的一些类被代替

嵌入式Servlet容器自动配置原理

主要的三个类:
在这里插入图片描述

1.ServletWebServerfactoryConfihration

有三个:EmbeddedUndertow ,EmbeddedJetty,EmbeddedTomcat @Conditionalxxx 标注的类;条件满足才向容器中添加组件
例如:添加tomcat

@Configuration
@ConditionalOnClass({Servlet.class, Tomcat.class, UpgradeProtocol.class})
@ConditionalOnMissingBean(
    value = {ServletWebServerFactory.class},
    search = SearchStrategy.CURRENT
  )
  public static class EmbeddedTomcat {
      public EmbeddedTomcat() {
       }

    @Bean
    public TomcatServletWebServerFactory tomcatServletWebServerFactory() {
    return new TomcatServletWebServerFactory();
       }
    }

重要注解详解:

1. @ConditionalOnClass({Servlet.class, Tomcat.class, UpgradeProtocol.class})

   容器中存在servlet.class(存在servlet依赖)  tomcat.class(tomcat依赖)  才能执行向容器中添加组件
   
2. @ConditionalOnMissingBean(value = {ServletWebServerFactory.class},search = SearchStrategy.CURRENT )
    判断容器中没有用户自定义的ServletWeServerbFactory

ServletWebServerFactory
嵌入式Servlet工厂;作用:创建嵌入式Servlet容器
容器工厂:
在这里插入图片描述继承树

当中只有一个方法:获取嵌入式Servlet容器 (WebServer)
public interface ServletWebServerFactory {
    WebServer getWebServer(ServletContextInitializer... var1);
}

容器工厂包含了:TomcatServletWebServerFactory,JettyServletWebServerFactory,UndetowServletWebServerFactory
webServr 嵌入式Servlet容器:
在这里插入图片描述继承树

在判断@ConditionalOnClass({Servlet.class, Tomcat.class, UpgradeProtocol.class})是否导入依赖,满足条件: return new TomcatServletWebServerFactory(); 添加对应的Servlet容器工厂;通过工厂的唯一方法getWebServer 获取对应的Servlet容器TomcatServer

TomcatServletWebServerFactory
tomcat 的容器工厂

在工厂中获取tomcat 的方法:getWebServer

 public WebServer getWebServer(ServletContextInitializer... initializers) {
       1. 创建Tomcat对象       
         Tomcat tomcat = new Tomcat();      
           
        File baseDir = this.baseDirectory != null ? this.baseDirectory : this.createTempDir("tomcat");
        tomcat.setBaseDir(baseDir.getAbsolutePath());
        
      2.完成tomct 配置的基本操作
        Connector connector = new Connector(this.protocol);
        tomcat.getService().addConnector(connector);
        this.customizeConnector(connector);
        tomcat.setConnector(connector);
        tomcat.getHost().setAutoDeploy(false);
        this.configureEngine(tomcat.getEngine());
        Iterator var5 = this.additionalTomcatConnectors.iterator();

        while(var5.hasNext()) {
            Connector additionalConnector = (Connector)var5.next();
            tomcat.getService().addConnector(additionalConnector);
        }

        this.prepareContext(tomcat.getHost(), initializers);
        
      3.将tomcat 传入方法:getTomcatWebServer()
        return this.getTomcatWebServer(tomcat);
    }
getTomcatWebServer()
protected TomcatWebServer getTomcatWebServer(Tomcat tomcat) {
        return new TomcatWebServer(tomcat, this.getPort() >= 0);  端口>0  就创建Tomcat 容器
    }

TomcatWebServer

对应的构造函数:在TomcatWebServer 中
public TomcatWebServer(Tomcat tomcat, boolean autoStart) {
       this.monitor = new Object();
       this.serviceConnectors = new HashMap();
       Assert.notNull(tomcat, "Tomcat Server must not be null");
       this.tomcat = tomcat;
       this.autoStart = autoStart;   自动启动变量
       this.initialize();
   }

方法:initialize()核心代码:
this.tomcat.start();    启动Tomcat

至此Tomcat就完成了配置和自动启动

2.ServletWebServerFactoryAutoConfiguration

修改定制Servlet 容器的方法:
配置文件和ServerProperties 绑定/修改定制组件 WebServerFactoryCustomizer
他们的本质是一样的:在ServletWebServerFactoryAutoConfiguration配置类中@EnableConfigurationProperties({ServerProperties.class})

导入了:BeanPostProcessorsRegistrar;在这个类的方法中添加了组件WebServerFactoryCustomizerBeanPostProcessor定制器后置处理器

也就是说一旦容器中添加任何组件都会启动定制后置处理器,进行Servlet的赋值

后置处理器起作用的过程:

在初始化之前:
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
   如果组件创建的对象是:WebServerFactory 就调用postProcessBeforeInitialization
        if (bean instanceof WebServerFactory) {       
            this.postProcessBeforeInitialization((WebServerFactory)bean);
        }

        return bean;
    }
解释:
自定义定制器:  
  @Bean
 public WebServerFactoryCustomizer<ConfigurableWebServerFactory> MyCustomizer(){
return new WebServerFactoryCustomizer<ConfigurableWebServerFactory>() {... }
}
public interface WebServerFactoryCustomizer<T extends WebServerFactory> {
    void customize(T var1);
} 

ConfigurableWebServerFactory继承WebServerFactory ;所以修改数据的时候创建了WeServerFactory
自动配置的时候也会创建对应的工厂对象
postProcessBeforeInitialization
核心语句:
    customizer.customize(webServerFactory);
获取spring Boot中所有的WebServerFactoryCustomizer 这个类型的定制器通过定制方法:customize()给Servlet容器赋值
同时这也是为什么自定义修改配置组件是自定义的WebServerFactoryCustomizer

3.ServletWebServerFactoryCustomizer

在这个配置类中:

private final ServerProperties serverProperties;

同时使用了:

 public void customize(ConfigurableServletWebServerFactory factory) {
 完成了Tomcat的各项配置的修改和定制

总结配置修改定制原理:以tomcat为例

  1. 使用修改定制器 webServerFactoryCustomizer 创建了ConfigurableWebServerFactory 对象,触发WebServerFactoryCustomizerBeanPostProcessor 后置处理器,判断是否为WebServerFactory 类型;

    ConfiurableWebServerFactory 继承webServerFactory

    满足条件,就会获取容器中的所有定制器(customizer.cutomize(bean)),为Servlet容器修改和定制配置【相关的配置类ServletWebServerFactoryAutoConfiguration;导入了定制处理器】

  2. 使用配置文件application.propertoes 修改配置。server 相关的配置修改是与ServerProperties 类绑定的,所以相关的修改会直接通过Serverproperties 的方法实现【相关的配置类:ServletWebServerFactoryCustomizer】


嵌入式Servlet 容器启动的原理(tomcat)

  1. SpringBoot 应用启动,运行run方法
  2. refreshContext(context) 刷新ioc 容器。创建web 应用的ioc 容器对象,并初始化容器
  3. 获取工厂容器组件:ServletWebServerFactory factory = this.getServletWebServerFactory ();
    tomcatServeltWebServerFactory 创建,触发后置处理器,配置类中:@EnableConfigurationProperties({ServerProperties.class}) 根据配置文件,获取所有的定制器为Sevlet容器赋值
  4. tomcatServerWebServletFactory 获取完成;获取TomcatWebServer 完成自启动

总结图示:
在这里插入图片描述
学习的目的:会自己定制修改Servlet 容器的配置

C:\Users\Lenovo\.jdks\corretto-1.8.0_462\bin\java.exe -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true "-Dmanagement.endpoints.jmx.exposure.include=*" "-javaagent:D:\IntelliJ IDEA 2025.2\lib\idea_rt.jar=2427" -Dfile.encoding=UTF-8 -classpath "C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\charsets.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\access-bridge-64.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\cldrdata.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\dnsns.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\jaccess.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\jfxrt.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\localedata.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\nashorn.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\sunec.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\sunjce_provider.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\sunmscapi.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\sunpkcs11.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\ext\zipfs.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\jce.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\jfr.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\jfxswt.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\jsse.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\management-agent.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\resources.jar;C:\Users\Lenovo\.jdks\corretto-1.8.0_462\jre\lib\rt.jar;E:\前后端代码\shigong-new_20250810 (2)\shigong-new - 副本\ruoyi-modules\activiti\target\classes;C:\JAVA\repository\com\alibaba\cloud\spring-cloud-starter-alibaba-nacos-discovery\2021.0.5.0\spring-cloud-starter-alibaba-nacos-discovery-2021.0.5.0.jar;C:\JAVA\repository\com\alibaba\cloud\spring-cloud-alibaba-commons\2021.0.5.0\spring-cloud-alibaba-commons-2021.0.5.0.jar;C:\JAVA\repository\com\alibaba\nacos\nacos-client\2.2.0\nacos-client-2.2.0.jar;C:\JAVA\repository\com\alibaba\nacos\nacos-auth-plugin\2.2.0\nacos-auth-plugin-2.2.0.jar;C:\JAVA\repository\com\alibaba\nacos\nacos-encryption-plugin\2.2.0\nacos-encryption-plugin-2.2.0.jar;C:\JAVA\repository\commons-codec\commons-codec\1.15\commons-codec-1.15.jar;C:\JAVA\repository\org\apache\httpcomponents\httpasyncclient\4.1.5\httpasyncclient-4.1.5.jar;C:\JAVA\repository\org\apache\httpcomponents\httpcore-nio\4.4.16\httpcore-nio-4.4.16.jar;C:\JAVA\repository\io\prometheus\simpleclient\0.15.0\simpleclient-0.15.0.jar;C:\JAVA\repository\io\prometheus\simpleclient_tracer_otel\0.15.0\simpleclient_tracer_otel-0.15.0.jar;C:\JAVA\repository\io\prometheus\simpleclient_tracer_common\0.15.0\simpleclient_tracer_common-0.15.0.jar;C:\JAVA\repository\io\prometheus\simpleclient_tracer_otel_agent\0.15.0\simpleclient_tracer_otel_agent-0.15.0.jar;C:\JAVA\repository\org\yaml\snakeyaml\1.30\snakeyaml-1.30.jar;C:\JAVA\repository\com\alibaba\spring\spring-context-support\1.0.11\spring-context-support-1.0.11.jar;C:\JAVA\repository\org\springframework\cloud\spring-cloud-commons\3.1.7\spring-cloud-commons-3.1.7.jar;C:\JAVA\repository\org\springframework\security\spring-security-crypto\5.7.9\spring-security-crypto-5.7.9.jar;C:\JAVA\repository\org\springframework\cloud\spring-cloud-context\3.1.7\spring-cloud-context-3.1.7.jar;C:\JAVA\repository\com\alibaba\cloud\spring-cloud-starter-alibaba-nacos-config\2021.0.5.0\spring-cloud-starter-alibaba-nacos-config-2021.0.5.0.jar;C:\JAVA\repository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;C:\JAVA\repository\com\mysql\mysql-connector-j\8.0.33\mysql-connector-j-8.0.33.jar;E:\前后端代码\shigong-new_20250810 (2)\shigong-new - 副本\ruoyi-common\ruoyi-common-core\target\classes;C:\JAVA\repository\org\springframework\cloud\spring-cloud-starter-openfeign\3.1.8\spring-cloud-starter-openfeign-3.1.8.jar;C:\JAVA\repository\org\springframework\cloud\spring-cloud-openfeign-core\3.1.8\spring-cloud-openfeign-core-3.1.8.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-starter-aop\2.7.13\spring-boot-starter-aop-2.7.13.jar;C:\JAVA\repository\org\aspectj\aspectjweaver\1.9.7\aspectjweaver-1.9.7.jar;C:\JAVA\repository\io\github\openfeign\form\feign-form-spring\3.8.0\feign-form-spring-3.8.0.jar;C:\JAVA\repository\io\github\openfeign\form\feign-form\3.8.0\feign-form-3.8.0.jar;C:\JAVA\repository\commons-fileupload\commons-fileupload\1.5\commons-fileupload-1.5.jar;C:\JAVA\repository\io\github\openfeign\feign-core\11.10\feign-core-11.10.jar;C:\JAVA\repository\io\github\openfeign\feign-slf4j\11.10\feign-slf4j-11.10.jar;C:\JAVA\repository\org\springframework\cloud\spring-cloud-starter-loadbalancer\3.1.7\spring-cloud-starter-loadbalancer-3.1.7.jar;C:\JAVA\repository\org\springframework\cloud\spring-cloud-loadbalancer\3.1.7\spring-cloud-loadbalancer-3.1.7.jar;C:\JAVA\repository\io\projectreactor\reactor-core\3.4.30\reactor-core-3.4.30.jar;C:\JAVA\repository\org\reactivestreams\reactive-streams\1.0.4\reactive-streams-1.0.4.jar;C:\JAVA\repository\io\projectreactor\addons\reactor-extra\3.4.10\reactor-extra-3.4.10.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-starter-cache\2.7.13\spring-boot-starter-cache-2.7.13.jar;C:\JAVA\repository\com\stoyanr\evictor\1.0.0\evictor-1.0.0.jar;C:\JAVA\repository\org\springframework\spring-context-support\5.3.28\spring-context-support-5.3.28.jar;C:\JAVA\repository\org\springframework\spring-beans\5.3.28\spring-beans-5.3.28.jar;C:\JAVA\repository\org\springframework\spring-context\5.3.28\spring-context-5.3.28.jar;C:\JAVA\repository\org\springframework\spring-aop\5.3.28\spring-aop-5.3.28.jar;C:\JAVA\repository\org\springframework\spring-expression\5.3.28\spring-expression-5.3.28.jar;C:\JAVA\repository\org\springframework\spring-core\5.3.28\spring-core-5.3.28.jar;C:\JAVA\repository\org\springframework\spring-jcl\5.3.28\spring-jcl-5.3.28.jar;C:\JAVA\repository\org\springframework\spring-web\5.3.28\spring-web-5.3.28.jar;C:\JAVA\repository\com\alibaba\transmittable-thread-local\2.14.3\transmittable-thread-local-2.14.3.jar;C:\JAVA\repository\com\github\pagehelper\pagehelper-spring-boot-starter\1.4.7\pagehelper-spring-boot-starter-1.4.7.jar;C:\JAVA\repository\com\github\pagehelper\pagehelper-spring-boot-autoconfigure\1.4.7\pagehelper-spring-boot-autoconfigure-1.4.7.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-starter-validation\2.7.13\spring-boot-starter-validation-2.7.13.jar;C:\JAVA\repository\org\apache\tomcat\embed\tomcat-embed-el\9.0.76\tomcat-embed-el-9.0.76.jar;C:\JAVA\repository\org\hibernate\validator\hibernate-validator\6.2.5.Final\hibernate-validator-6.2.5.Final.jar;C:\JAVA\repository\jakarta\validation\jakarta.validation-api\2.0.2\jakarta.validation-api-2.0.2.jar;C:\JAVA\repository\org\jboss\logging\jboss-logging\3.4.3.Final\jboss-logging-3.4.3.Final.jar;C:\JAVA\repository\com\fasterxml\classmate\1.5.1\classmate-1.5.1.jar;C:\JAVA\repository\com\fasterxml\jackson\core\jackson-databind\2.13.5\jackson-databind-2.13.5.jar;C:\JAVA\repository\com\alibaba\fastjson2\fastjson2\2.0.39\fastjson2-2.0.39.jar;C:\JAVA\repository\io\jsonwebtoken\jjwt\0.9.1\jjwt-0.9.1.jar;C:\JAVA\repository\javax\xml\bind\jaxb-api\2.3.1\jaxb-api-2.3.1.jar;C:\JAVA\repository\javax\activation\javax.activation-api\1.2.0\javax.activation-api-1.2.0.jar;C:\JAVA\repository\org\apache\commons\commons-lang3\3.12.0\commons-lang3-3.12.0.jar;C:\JAVA\repository\commons-io\commons-io\2.13.0\commons-io-2.13.0.jar;C:\JAVA\repository\org\apache\poi\poi-ooxml\4.1.2\poi-ooxml-4.1.2.jar;C:\JAVA\repository\org\apache\poi\poi-ooxml-schemas\4.1.2\poi-ooxml-schemas-4.1.2.jar;C:\JAVA\repository\org\apache\xmlbeans\xmlbeans\3.1.0\xmlbeans-3.1.0.jar;C:\JAVA\repository\com\github\virtuald\curvesapi\1.06\curvesapi-1.06.jar;C:\JAVA\repository\org\apache\poi\poi\4.1.2\poi-4.1.2.jar;C:\JAVA\repository\org\apache\commons\commons-collections4\4.4\commons-collections4-4.4.jar;C:\JAVA\repository\org\apache\commons\commons-math3\3.6.1\commons-math3-3.6.1.jar;C:\JAVA\repository\com\zaxxer\SparseBitSet\1.2\SparseBitSet-1.2.jar;C:\JAVA\repository\javax\servlet\javax.servlet-api\4.0.1\javax.servlet-api-4.0.1.jar;C:\JAVA\repository\com\baomidou\mybatis-plus-boot-starter\3.3.0\mybatis-plus-boot-starter-3.3.0.jar;C:\JAVA\repository\com\baomidou\mybatis-plus\3.3.0\mybatis-plus-3.3.0.jar;C:\JAVA\repository\com\baomidou\mybatis-plus-extension\3.3.0\mybatis-plus-extension-3.3.0.jar;C:\JAVA\repository\com\baomidou\mybatis-plus-core\3.3.0\mybatis-plus-core-3.3.0.jar;C:\JAVA\repository\com\baomidou\mybatis-plus-annotation\3.3.0\mybatis-plus-annotation-3.3.0.jar;C:\JAVA\repository\org\apache\httpcomponents\httpclient\4.5.14\httpclient-4.5.14.jar;C:\JAVA\repository\org\apache\httpcomponents\httpmime\4.5.14\httpmime-4.5.14.jar;C:\JAVA\repository\cn\hutool\hutool-all\5.3.4\hutool-all-5.3.4.jar;C:\JAVA\repository\org\apache\httpcomponents\httpcore\4.4.16\httpcore-4.4.16.jar;C:\JAVA\repository\com\drewnoakes\metadata-extractor\2.15.0\metadata-extractor-2.15.0.jar;C:\JAVA\repository\com\adobe\xmp\xmpcore\6.0.6\xmpcore-6.0.6.jar;C:\JAVA\repository\com\belerweb\pinyin4j\2.5.0\pinyin4j-2.5.0.jar;C:\JAVA\repository\commons-beanutils\commons-beanutils\1.9.4\commons-beanutils-1.9.4.jar;C:\JAVA\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\JAVA\repository\commons-collections\commons-collections\3.2.2\commons-collections-3.2.2.jar;C:\JAVA\repository\org\locationtech\proj4j\proj4j\1.3.0\proj4j-1.3.0.jar;C:\JAVA\repository\org\locationtech\proj4j\proj4j-epsg\1.3.0\proj4j-epsg-1.3.0.jar;C:\JAVA\repository\org\jsoup\jsoup\1.12.1\jsoup-1.12.1.jar;C:\JAVA\repository\org\freemarker\freemarker\2.3.32\freemarker-2.3.32.jar;E:\前后端代码\shigong-new_20250810 (2)\shigong-new - 副本\ruoyi-common\ruoyi-common-log\target\classes;E:\前后端代码\shigong-new_20250810 (2)\shigong-new - 副本\ruoyi-common\ruoyi-common-security\target\classes;C:\JAVA\repository\org\springframework\spring-webmvc\5.3.28\spring-webmvc-5.3.28.jar;E:\前后端代码\shigong-new_20250810 (2)\shigong-new - 副本\ruoyi-api\ruoyi-api-system\target\classes;E:\前后端代码\shigong-new_20250810 (2)\shigong-new - 副本\ruoyi-common\ruoyi-common-redis\target\classes;C:\JAVA\repository\org\springframework\boot\spring-boot-starter-data-redis\2.7.13\spring-boot-starter-data-redis-2.7.13.jar;C:\JAVA\repository\org\springframework\data\spring-data-redis\2.7.13\spring-data-redis-2.7.13.jar;C:\JAVA\repository\org\springframework\data\spring-data-keyvalue\2.7.13\spring-data-keyvalue-2.7.13.jar;C:\JAVA\repository\org\springframework\data\spring-data-commons\2.7.13\spring-data-commons-2.7.13.jar;C:\JAVA\repository\org\springframework\spring-oxm\5.3.28\spring-oxm-5.3.28.jar;C:\JAVA\repository\redis\clients\jedis\3.8.0\jedis-3.8.0.jar;C:\JAVA\repository\org\apache\commons\commons-pool2\2.11.1\commons-pool2-2.11.1.jar;C:\JAVA\repository\org\gavaghan\geodesy\1.1.3\geodesy-1.1.3.jar;C:\JAVA\repository\org\mybatis\spring\boot\mybatis-spring-boot-starter\2.1.3\mybatis-spring-boot-starter-2.1.3.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-starter\2.7.13\spring-boot-starter-2.7.13.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-starter-logging\2.7.13\spring-boot-starter-logging-2.7.13.jar;C:\JAVA\repository\ch\qos\logback\logback-classic\1.2.12\logback-classic-1.2.12.jar;C:\JAVA\repository\ch\qos\logback\logback-core\1.2.12\logback-core-1.2.12.jar;C:\JAVA\repository\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;C:\JAVA\repository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;C:\JAVA\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-starter-jdbc\2.7.13\spring-boot-starter-jdbc-2.7.13.jar;C:\JAVA\repository\com\zaxxer\HikariCP\4.0.3\HikariCP-4.0.3.jar;C:\JAVA\repository\org\springframework\spring-jdbc\5.3.28\spring-jdbc-5.3.28.jar;C:\JAVA\repository\org\springframework\spring-tx\5.3.28\spring-tx-5.3.28.jar;C:\JAVA\repository\org\mybatis\spring\boot\mybatis-spring-boot-autoconfigure\2.1.3\mybatis-spring-boot-autoconfigure-2.1.3.jar;C:\JAVA\repository\org\mybatis\mybatis\3.5.5\mybatis-3.5.5.jar;C:\JAVA\repository\org\mybatis\mybatis-spring\2.0.5\mybatis-spring-2.0.5.jar;C:\JAVA\repository\org\apache\logging\log4j\log4j-api\2.17.1\log4j-api-2.17.1.jar;C:\JAVA\repository\com\github\pagehelper\pagehelper\5.1.8\pagehelper-5.1.8.jar;C:\JAVA\repository\com\github\jsqlparser\jsqlparser\1.2\jsqlparser-1.2.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-starter-websocket\2.7.13\spring-boot-starter-websocket-2.7.13.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-starter-web\2.7.13\spring-boot-starter-web-2.7.13.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-starter-json\2.7.13\spring-boot-starter-json-2.7.13.jar;C:\JAVA\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.5\jackson-datatype-jdk8-2.13.5.jar;C:\JAVA\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.5\jackson-datatype-jsr310-2.13.5.jar;C:\JAVA\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.5\jackson-module-parameter-names-2.13.5.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-starter-tomcat\2.7.13\spring-boot-starter-tomcat-2.7.13.jar;C:\JAVA\repository\org\apache\tomcat\embed\tomcat-embed-core\9.0.76\tomcat-embed-core-9.0.76.jar;C:\JAVA\repository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.76\tomcat-embed-websocket-9.0.76.jar;C:\JAVA\repository\org\springframework\spring-messaging\5.3.28\spring-messaging-5.3.28.jar;C:\JAVA\repository\org\springframework\spring-websocket\5.3.28\spring-websocket-5.3.28.jar;C:\JAVA\repository\org\projectlombok\lombok\1.18.28\lombok-1.18.28.jar;C:\JAVA\repository\io\minio\minio\8.4.5\minio-8.4.5.jar;C:\JAVA\repository\com\carrotsearch\thirdparty\simple-xml-safe\2.7.1\simple-xml-safe-2.7.1.jar;C:\JAVA\repository\com\google\guava\guava\30.1.1-jre\guava-30.1.1-jre.jar;C:\JAVA\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\JAVA\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\JAVA\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\JAVA\repository\org\checkerframework\checker-qual\3.8.0\checker-qual-3.8.0.jar;C:\JAVA\repository\com\google\errorprone\error_prone_annotations\2.5.1\error_prone_annotations-2.5.1.jar;C:\JAVA\repository\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;C:\JAVA\repository\com\fasterxml\jackson\core\jackson-annotations\2.13.5\jackson-annotations-2.13.5.jar;C:\JAVA\repository\com\fasterxml\jackson\core\jackson-core\2.13.5\jackson-core-2.13.5.jar;C:\JAVA\repository\org\bouncycastle\bcprov-jdk15on\1.69\bcprov-jdk15on-1.69.jar;C:\JAVA\repository\org\apache\commons\commons-compress\1.21\commons-compress-1.21.jar;C:\JAVA\repository\org\xerial\snappy\snappy-java\1.1.8.4\snappy-java-1.1.8.4.jar;C:\JAVA\repository\com\squareup\okhttp3\okhttp\4.9.0\okhttp-4.9.0.jar;C:\JAVA\repository\com\squareup\okio\okio\2.8.0\okio-2.8.0.jar;C:\JAVA\repository\org\jetbrains\kotlin\kotlin-stdlib-common\1.6.21\kotlin-stdlib-common-1.6.21.jar;C:\JAVA\repository\org\jetbrains\kotlin\kotlin-stdlib\1.6.21\kotlin-stdlib-1.6.21.jar;C:\JAVA\repository\org\jetbrains\annotations\13.0\annotations-13.0.jar;C:\JAVA\repository\net\coobird\thumbnailator\0.4.8\thumbnailator-0.4.8.jar;C:\JAVA\repository\org\springframework\cloud\spring-cloud-starter-bootstrap\3.1.7\spring-cloud-starter-bootstrap-3.1.7.jar;C:\JAVA\repository\org\springframework\cloud\spring-cloud-starter\3.1.7\spring-cloud-starter-3.1.7.jar;C:\JAVA\repository\org\springframework\security\spring-security-rsa\1.0.11.RELEASE\spring-security-rsa-1.0.11.RELEASE.jar;C:\JAVA\repository\org\bouncycastle\bcpkix-jdk15on\1.69\bcpkix-jdk15on-1.69.jar;C:\JAVA\repository\org\bouncycastle\bcutil-jdk15on\1.69\bcutil-jdk15on-1.69.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-configuration-processor\2.7.13\spring-boot-configuration-processor-2.7.13.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-devtools\2.7.13\spring-boot-devtools-2.7.13.jar;C:\JAVA\repository\org\springframework\boot\spring-boot\2.7.13\spring-boot-2.7.13.jar;C:\JAVA\repository\org\springframework\boot\spring-boot-autoconfigure\2.7.13\spring-boot-autoconfigure-2.7.13.jar" com.yupont.app.ActivitiApplication 10:13:52.793 [Thread-1] DEBUG org.springframework.boot.devtools.restart.classloader.RestartClassLoader - Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader@28b66390 2025-08-21 10:13:53.059 INFO 3976 --- [ restartedMain] c.a.n.client.env.SearchableProperties : properties search order:PROPERTIES->JVM->ENV->DEFAULT_SETTING 2025-08-21 10:13:53.175 INFO 3976 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set &#39;spring.devtools.add-properties&#39; to &#39;false&#39; to disable 2025-08-21 10:13:53.382 INFO 3976 --- [ restartedMain] c.a.n.p.a.s.c.ClientAuthPluginManager : [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.impl.NacosClientAuthServiceImpl success. 2025-08-21 10:13:53.382 INFO 3976 --- [ restartedMain] c.a.n.p.a.s.c.ClientAuthPluginManager : [ClientAuthPluginManager] Load ClientAuthService com.alibaba.nacos.client.auth.ram.RamClientAuthServiceImpl success. . ____ _ __ _ _ /\\ / ___&#39;_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | &#39;_ | &#39;_| | &#39;_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) &#39; |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.7.13) 2025-08-21 10:14:00.385 WARN 3976 --- [ restartedMain] c.a.c.n.c.NacosPropertySourceBuilder : Ignore the empty nacos configuration and get it based on dataId[null.properties] & group[DEFAULT_GROUP] 2025-08-21 10:14:00.386 INFO 3976 --- [ restartedMain] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name=&#39;bootstrapProperties-null.properties,DEFAULT_GROUP&#39;}] 2025-08-21 10:14:00.399 INFO 3976 --- [ restartedMain] com.yupont.app.ActivitiApplication : No active profile set, falling back to 1 default profile: "default" 2025-08-21 10:14:01.046 INFO 3976 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode 2025-08-21 10:14:01.048 INFO 3976 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode. 2025-08-21 10:14:01.059 INFO 3976 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 3 ms. Found 0 Redis repository interfaces. 2025-08-21 10:14:01.160 WARN 3976 --- [ restartedMain] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in &#39;[com.yupont.app.*.dao]&#39; package. Please check your configuration. 2025-08-21 10:14:01.199 INFO 3976 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=84bfe0a8-a36d-3907-9c5a-a783377777d2 2025-08-21 10:14:01.711 INFO 3976 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2025-08-21 10:14:01.719 INFO 3976 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2025-08-21 10:14:01.719 INFO 3976 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.76] 2025-08-21 10:14:01.867 INFO 3976 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2025-08-21 10:14:01.867 INFO 3976 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1444 ms 2025-08-21 10:14:02.381 WARN 3976 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;dataSource&#39; defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method &#39;dataSource&#39; threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class 2025-08-21 10:14:02.382 INFO 3976 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 2025-08-21 10:14:02.392 INFO 3976 --- [ restartedMain] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with &#39;debug&#39; enabled. 2025-08-21 10:14:02.410 ERROR 3976 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPLICATION FAILED TO START *************************** Description: Failed to configure a DataSource: &#39;url&#39; attribute is not specified and no embedded datasource could be configured. Reason: Failed to determine a suitable driver class Action: Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active). 2025-08-21 10:14:02.412 WARN 3976 --- [ Thread-12] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Start destroying Publisher 2025-08-21 10:14:02.412 WARN 3976 --- [ Thread-5] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Start destroying common HttpClient 2025-08-21 10:14:02.412 WARN 3976 --- [ Thread-12] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Destruction of the end 进程已结束,退出代码为 0
最新发布
08-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值