首页 > 其他分享 >SpringBoot复习:(38)WebServerFactoryCustomizer

SpringBoot复习:(38)WebServerFactoryCustomizer

时间:2023-08-21 17:34:12浏览次数:33  
标签:web 38 SpringBoot boot springframework WebServerFactoryCustomizer org import


可以通过这种方式对内嵌的Servlet容器进行配置

package cn.edu.tju.config;

import org.springframework.boot.web.server.ConfigurableWebServerFactory;
import org.springframework.boot.web.server.WebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.stereotype.Component;

@Component
public class MyWebServerFactoryCustomizer implements WebServerFactoryCustomizer<ConfigurableWebServerFactory> {

    @Override
    public void customize(ConfigurableWebServerFactory factory) {
        factory.setPort(9696);
    }
}


标签:web,38,SpringBoot,boot,springframework,WebServerFactoryCustomizer,org,import
From: https://blog.51cto.com/amadeusliu/7177773

相关文章

  • SpringBoot复习:(41)配置文件中配置的server开头的属性是怎么配置到Servlet容器中起作用
    ServletWebServerFactoryAutoConfiguration类:可以看到其中使用了@EnableConfigurationProperties导入了ServerProperties而ServerProperties通过使用@ConfigurationProperties注解导入了配置文件中已server开头的那些配置项。可以看到ServletWebServerFactory定义了一个类型为Se......
  • SpringBoot复习:(33)WebMvcAutoconfiguration内部静态类WebMvcAutoConfigurationAdapter
    WebMvcAutoconfiguration内部静态类WebMvcAutoConfigurationAdapter实现了WebMvcConfigurer接口,重写了一些方法,也就是默认对SpringMvc进行了一些配置:该静态类上有个**@Import**注解:@Import(EnableWebMvcConfiguration.class)它的父类DelegatingWebMvcConfiguration,通过注入......
  • SpringBoot如何进行统一版本的管理
    在springboot中,可以通过以下两种方式实现统一版本的管理:1、通过标签<parent>如:<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>1.4.1.......
  • springboot利用hutool快速生成验证码
    生成验证码publicclassVerificationCodeUtil{publicstaticVerificationCodegetVerification(){LineCaptchacaptcha=CaptchaUtil.createLineCaptcha(70,35,4,30);Stringkey=IdUtil.get32Uuid();VerificationCodeverificationCode......
  • 在springboot项目中部署vue打包的dist以及刷新遇到404的解决方法
    一、在springboot项目中部署dist新建一个springboot项目,并将dist复制到resources目录下面,同时在application.yml添加配置即可,操作结果如下图所示: 添加的配置代码如下:spring:web:resources:static-locations:"classpath:/dist"二、部署好之后刷新遇到404......
  • Springboot-starter
    1.Spring手动注入和自动注入通常情况下,系统中类和类之间是有依赖关系的,如果一个类对外提供的功能需要通过调用其他类的方法来实现的时候,说明这两个类之间存在依赖关系。example:publicclassUserService{publicvoidinsert(UserModelmodel){//插入用户信息......
  • html多文件上传(springboot)
    一、文件的上传1、前端html上传文件(1)html代码:<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>Title</title><linkrel="stylesheet"href="https://cdn.staticfile.org......
  • P6638 「JYLOI Round 1」常规
    容易把问题转换为求前缀和。设\(p\)为当前最大的下标使得\(a_p\leqx\),则容易得到答案:\[\text{ans}=\sum_{i=1}^{p}\left\lfloor\dfrac{x-a_p}{k}\right\rfloor\]比较难直接维护,所以稍微化简一下:\[\text{ans}=\dfrac{1}{k}\sum_{i=1}^{p}x-a_p-(x-a_p)......
  • SpringBoot整合swagger+MP+PageHelper
    1.SpringBoot整swagger接口文档【接口文档的作用:就是为了方便前后端的交互】1.1swagger依赖  <!--引入swagger2依赖-->    <dependency>      <groupId>com.spring4all</groupId>      <artifactId>swagger-spring-boot-starter</arti......
  • 基于SpringBoot的在线文档管理系统的设计与实现
    研究目的及意义随着信息技术的发展,为了提高文档管理效率,而开发了本基于SpringBoot的在线文档管理系统,本在线文档管理系统的开发具有很大的现实意义和实用意义。首先,在操作流程上,管理员和用户都只需要访问网页,便可进行文档信息的管理。不需要像手工记录,快速便捷,提高了文档管理的准......