SpringBoot--SpringMVC自动配置原理、自定义配置

《供应链金融风控模型设计:多维度数据整合与动态风险预警机制》 注:方案突出供应链金融「三流合一」(资金流、物流、信息流)的风控逻辑,通过多维度数据整合与动态预警,解决传统风控中中小企业信用评估难、链条风险传导监测滞后的问题。◦ 构建供应链拓扑图,计算「核心企业违约对上下游企业的影响系数」(如某电子厂商违约时,其前五大供应商的风险权重自动提升40%)• 区块链应用:将核心企业应付账款上链存证,防止「一票多融」欺诈(如某供应商用同一应收账款在多家银行融资)◦ 财务数据:核心企业审计报告、上下游企业纳税数据(增值税发票频次/金额) 阅读详情

4、SpringMVC自动配置

https://docs.spring.io/spring-boot/docs/1.5.10.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications

1. Spring MVC auto-configuration

Spring Boot 自动配置好了SpringMVC

以下是SpringBoot对SpringMVC的默认配置:(WebMvcAutoConfiguration)

  • Inclusion of ContentNegotiatingViewResolver and BeanNameViewResolver beans.

    • 自动配置了ViewResolver(视图解析器:根据方法的返回值得到视图对象(View),视图对象决定如何渲染(转发?重定向?))
    • ContentNegotiatingViewResolver:组合所有的视图解析器的;
    • 如何定制:我们可以自己给容器中添加一个视图解析器;自动的将其组合进来;
  • Support for serving static resources, including support for WebJars (see below).静态资源文件夹路径,webjars

  • Static index.html support. 静态首页访问

  • Custom Favicon support (see below). favicon.ico

    ​

  • 自动注册了 of Converter, GenericConverter, Formatter beans.

    • Converter:转换器; public String hello(User user):类型转换使用Converter
    • Formatter 格式化器; 2017.12.17===Date;
		@Bean
		@ConditionalOnProperty(prefix = "spring.mvc", name = "date-format")//在文件中配置日期格式化的规则
		public Formatter<Date> dateFormatter() {
			return new DateFormatter(this.mvcProperties.getDateFormat());//日期格式化组件
		}

​ 自己添加的格式化器转换器,我们只需要放在容器中即可

  • Support for HttpMessageConverters (see below).

    • HttpMessageConverter:SpringMVC用来转换Http请求和响应的;User—Json;

    • HttpMessageConverters 是从容器中确定;获取所有的HttpMessageConverter;

      自己给容器中添加HttpMessageConverter,只需要将自己的组件注册容器中(@Bean,@Component)

      ​

  • Automatic registration of MessageCodesResolver (see below).定义错误代码生成规则

  • Automatic use of a ConfigurableWebBindingInitializer bean (see below).

    我们可以配置一个ConfigurableWebBindingInitializer来替换默认的;(添加到容器)

    初始化WebDataBinder;
    请求数据=====JavaBean;
    

org.springframework.boot.autoconfigure.web:web的所有自动场景;

If you want to keep Spring Boot MVC features, and you just want to add additional MVC configuration (interceptors, formatters, view controllers etc.) you can add your own @Configuration class of type WebMvcConfigurerAdapter, but without @EnableWebMvc. If you wish to provide custom instances of RequestMappingHandlerMapping, RequestMappingHandlerAdapter or ExceptionHandlerExceptionResolver you can declare a WebMvcRegistrationsAdapter instance providing such components.

If you want to take complete control of Spring MVC, you can add your own @Configuration annotated with @EnableWebMvc.

2、扩展SpringMVC

    <mvc:view-controller path="/hello" view-name="success"/>
    <mvc:interceptors>
        <mvc:interceptor>
            <mvc:mapping path="/hello"/>
            <bean></bean>
        </mvc:interceptor>
    </mvc:interceptors>

编写一个配置类(@Configuration),是WebMvcConfigurerAdapter类型;不能标注@EnableWebMvc;

既保留了所有的自动配置,也能用我们扩展的配置;

//使用WebMvcConfigurerAdapter可以来扩展SpringMVC的功能
@Configuration
public class MyMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
       // super.addViewControllers(registry);
        //浏览器发送 /atguigu 请求来到 success
        registry.addViewController("/atguigu").setViewName("success");
    }
}

原理:

​ 1)、WebMvcAutoConfiguration是SpringMVC的自动配置类

​ 2)、在做其他自动配置时会导入;@Import(EnableWebMvcConfiguration.class)

    @Configuration
	public static class EnableWebMvcConfiguration extends DelegatingWebMvcConfiguration {
      private final WebMvcConfigurerComposite configurers = new WebMvcConfigurerComposite();

	 //从容器中获取所有的WebMvcConfigurer
      @Autowired(required = false)
      public void setConfigurers(List<WebMvcConfigurer> configurers) {
          if (!CollectionUtils.isEmpty(configurers)) {
              this.configurers.addWebMvcConfigurers(configurers);
            	//一个参考实现;将所有的WebMvcConfigurer相关配置都来一起调用;  
            	@Override
             // public void addViewControllers(ViewControllerRegistry registry) {
              //    for (WebMvcConfigurer delegate : this.delegates) {
               //       delegate.addViewControllers(registry);
               //   }
              }
          }
	}

​ 3)、容器中所有的WebMvcConfigurer都会一起起作用;

​ 4)、我们的配置类也会被调用;

​ 效果:SpringMVC的自动配置和我们的扩展配置都会起作用;

3、全面接管SpringMVC;

SpringBoot对SpringMVC的自动配置不需要了,所有都是我们自己配置;所有的SpringMVC的自动配置都失效了

我们需要在配置类中添加@EnableWebMvc即可;

//使用WebMvcConfigurerAdapter可以来扩展SpringMVC的功能
@EnableWebMvc
@Configuration
public class MyMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
       // super.addViewControllers(registry);
        //浏览器发送 /atguigu 请求来到 success
        registry.addViewController("/atguigu").setViewName("success");
    }
}

原理:

为什么@EnableWebMvc自动配置就失效了;

1)@EnableWebMvc的核心

@Import(DelegatingWebMvcConfiguration.class)
public @interface EnableWebMvc {

2)、

@Configuration
public class DelegatingWebMvcConfiguration extends WebMvcConfigurationSupport {

3)、

@Configuration
@ConditionalOnWebApplication
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class,
		WebMvcConfigurerAdapter.class })
//容器中没有这个组件的时候,这个自动配置类才生效
@ConditionalOnMissingBean(WebMvcConfigurationSupport.class)
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE + 10)
@AutoConfigureAfter({ DispatcherServletAutoConfiguration.class,
		ValidationAutoConfiguration.class })
public class WebMvcAutoConfiguration {

4)、@EnableWebMvc将WebMvcConfigurationSupport组件导入进来;

5)、导入的WebMvcConfigurationSupport只是SpringMVC最基本的功能;

手把手教你用NE555+LM324搭建红外倒车雷达(附Multisim仿真文件) 本文详细介绍了如何使用NE555定时器和LM324运算放大器搭建一个红外倒车雷达系统。内容涵盖从核心原理拆解、模块电路设计(包括红外发射、接收放大、检波与电压比较)到实战焊接调试的全过程,并提供了Multisim仿真验证思路,帮助电子爱好者与初学者将模拟电路理论转化为可工作的实用项目。 阅读详情

相关推荐

SpringBoot不用三方框架,怎么动态调度定时任务,ScheduledExecutorService 详解

Spring Boot 提供了强大的定时任务支持,无需依赖任何第三方框架,即可轻松实现可配置的定时任务。通过使用 `@EnableScheduling` 注解启用定时任务支持后,我们可以利用 `@Scheduled` 注解来定义定时任务的方法,这些方法可以在指定的时间间隔或特定时间点自动执行。 我们还可以通过集成 `ScheduledExecutorService` 来实现灵活的定时任务管理。`ScheduledExecutorService` 是 Java 标准库的一部分,能够以固定速率或延迟执行任务,

横竖撇折点 1938

Spring Boot Web的相关配置

Spring Boot 提供了一下两个类来配置 WEB配置 org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration org.springframework.boot.autoconfigure.web.WebMvcProperties 具体查看源码。 1、自动配置 ViewResolver 1)ContentNe...

若疆~赤云 656

STM32硬件SPI驱动ADS1255/1256避坑指南:从Cube MX配置到稳定采样实战

本文详细解析了使用STM32硬件SPI驱动高精度ADC芯片ADS1255/1256的完整流程与关键陷阱。重点阐述了Cube MX中SPI模式(必须为CPOL=1, CPHA=1)、数据帧格式(MSB First)及波特率(建议从256kHz起)的正确配置,并提供了分步读写时序的代码实现与逻辑分析仪调试方法,帮助开发者避开常见坑点,实现稳定可靠的高精度数据采样。

weixin_29193259的博客 360

SpringBoot 整合 Activiti 因依赖冲突产生的异常

环境 SpringBoot:2.2.1.RELEASE Maven:3.6.1 java.version:1.8 开始配置的Activiti依赖 <dependency> <groupId>org.activiti</groupId> <artifactId>activiti-spring-boot-starter-basic&l...

yage124的博客 3789

基于live555实现一个rtsp客户端程序

本文介绍了基于live555流媒体库实现的RTSP客户端程序,能够通过RTSP地址获取H.264/H.265裸码流或TS流数据并存入本地文件。详细阐述了使用CLion搭建工程的代码架构和CMake配置,重点分析了TS流解析模块的实现,包括TS包结构解析、PES包提取和ES裸流获取的完整流程。文章提供了TS/PES/ES三种数据包的协议说明,并给出了从TS流中提取视频帧的具体方法,最后附有工程代码下载链接。该方案实现了RTSP流媒体接收、解析和存储的完整功能链。

kk821521286的博客 789

fastjson1.2.83反序列化漏洞

【代码】fastjson1.2.83反序列化漏洞。

Coder的博客 1万+

Spring Boot 自定义异常处理

Spring Boot 自定义异常处理 在 Spring Boot 项目中 ,异常统一处理,可以使用 Spring 中 @ControllerAdvice 来统一处理,也可以自己来定义异常处理方案。Spring Boot 中,对异常的处理有一些默认的策略,我们分别来看。 package exception; import org.springframework.web.bind.annotati...

liuzuoping的博客 1109

剑灵解包器修改xml.dat文件修改乳量方法

本篇内容是基于单机版网游改单机版游戏剑灵的内容,主要针对关于单机版进行数据修改,当然了对于网端有关于剑灵已有很多,像小助手等多种可以更改,但是存在有封号危险,好,下面我们是在单机版中来进行乳量的修改教程。

灵魂学者的博客 3300

springboot静态资源配置原理

经过我们分析springboot的自动装配原理之后,我们知道了,再springboot 一启动,就会注册我们导入依赖的场景中的所有组件。 我们要分析静态资源的配置原理,那么我们需要去看关于资源配置的自动配置类,我们直接找到springMVC的自动配置类 位于org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration springmvc的自动配置类就集中在这个类,但是整个完整的springMVC功能需要和其他的web场

技术积累,技术分享 1057

接口自动化测试如何做?测试老鸟总结,接口测试数据构造大全......

接口参数的数据获取:接口文档:接口文档通常会包含接口需要的请求参数和返回结果的格式、类型等信息;测试用例设计:根据测试用例设计的需求,可以确定需要哪些请求参数以及期望的响应结果;业务数据:从实际业务场景中获取数据,以确保测试数据的真实性和代表性;数据库:从数据库中获取数据,作为接口测试的输入参数;随机数据生成器:通过随机数据生成器生成测试数据,以增加测试用例的多样性和覆盖率。在选择数据来源时,需要根据具体情况进行选择。如果有可靠的接口文档,可以直接从文档中获取请求参数和预期结果;

798

32位快速加法器设计

32位快速加法器设计

好好学习,天天向上 3290

源码 解析_springboot源码架构解析WebMvcAutoConfiguration

说在前面前期回顾sharding-jdbc源码解析更新完毕spring源码解析 更新完毕spring-mvc源码解析 更新完毕spring-tx源码解析 更新完毕spring-boot源码解析 更新完毕rocketmq源码解析 更新完毕dubbbo源码解析 更新完毕netty源码解析 更新完毕spring源码架构更新完毕spring-mvc源码架构更新完毕springboot源码架构更...

weixin_39878855的博客 457

HBV模型

据说mHM模型也是基于HBV模型原理。 网上不同版本的HBV模型稍有差别 def hbv_main(n_days, params, air_temp, prec, dpem): #n_days 模拟天数 #air_temp 每月温度 #prec 降水 #dpem 每月蒸发 Tsnow_thresh = 0.0 ca = 410. # Initialize arrays for the simiulation snow = np.zeros(air_temp.size

m0_46268055的博客 2329

Spring Boot中的Thymeleaf、自动配置、国际化、容器

SpringBoot 系列: 1.Spring Boot 入门 文章目录SpringBoot 开发 WebThymeleafweb 定制容器定制 SpringBoot 开发 Web 在 Spring Boot 入门 中,我们知道了: 如何根据我们需要的模块创建一个 Spring Boot 应用 自动配置的原理 SpringBoot对静态资源的映射规则: 以 jar 包的方式引入静态资源,...

MOKE_SPACE 2180

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

【SpringBoot学习笔记 八】SpringBoot定制整合SpringMVC

上篇Blog详细探讨了SpringBoot是如何整合数据源的,从JDBC层面、数据源连接池层面(Druid),再到MyBatis层面。我们分别使用了`spring-boot-starter-data-jdbc、druid-spring-boot-starter、mybatis-spring-boot-starter`这三个封装好的场景启动器,通过SpringBoot的自动配置机制我们只需要关心yml配置文件内容即可简单方便的使用SpringBoot操作数据库,可以说非常方便,至少比起Spring整合MyBa

MaoLin Tian's Blog 835

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

Spring Boot——MVC自动配置原理

讲解SpringBoot中MVC的自动配置,用简单的例子讲解自动配置原理。

一心同学的博客 1202

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

SpringBoot源码剖析

本文深入剖析了SpringBoot的核心机制:1. 依赖管理通过spring-boot-starter-parent统一管理版本,实现依赖自动传递;2. 自动配置基于@EnableAutoConfiguration加载spring.factories中的配置类,结合条件注解实现智能装配;3. 启动流程通过SpringApplication.run()完成环境准备、上下文初始化和内嵌容器启动;4. 内嵌Tomcat通过ServletWebServerFactoryAutoConfiguration实现容器自动

guslegend的博客 780

【主流技术】Spring Boot Starter 的应用场景与自动配置

合集 - Java后端(16)1.【解决方案】如何使用 Http API 代替 OpenFeign 进行远程服务调用2024-01-222.【深度思考】一线开发大头兵对于工作的感悟分享2024-01-293.【进阶篇】Java 实际开发中积累的几个小技巧(一)2024-02-044.【设计模式】分享 Java 开发中常用到的设计模式(一)2023-08-095.【解决方案】Java 互联网项目如何...

weixin_42065161的博客 175

MVC自动配置原理---SpringBoot

MVC自动配置原理 官网阅读 在进行项目编写前,我们还需要知道一个东西,就是SpringBoot对我们的SpringMVC还做了哪些配置,包括如何扩展,如何定制。 只有把这些都搞清楚了,我们在之后使用才会更加得心应手。途径一:源码分析,途径二:官方文档! 地址 :https://docs.spring.io/spring-boot/docs/2.4.1.RELEASE/reference/htmlsingle/#boot-features-spring-mvc-auto-configuration Spri

Frank---7的博客 6万+

springboot7--->springboot是如何自动配置springmvc的原理分析

1、在传统的springMvc项目里面,我们会将DispatcherServlet配置在web.xml中,案例如下: <servlet> <servlet-name>springmvc</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <ini

qq_34978129的博客 271

关于springmvc在springboot的自动配置原理

关于springmvc在springboot的自动配置原理 自动配置 关于自动配置,可以参考一下官方给出的说明: The auto-configuration adds the following features on top of Spring’s defaults: Inclusion of ContentNegotiatingViewResolver and BeanNameViewR...

长门有一 314

springboot web开发springmvc自动配置原理

前言 我们也知道springboot启用springmvc基本不用做什么配置可以很方便就使用了但是不了解原理,开发过程中遇到点问题估计就比较头疼,不管了解的深不深入,先巴拉一番再说… 下面我们先看看官网…我的版本是2.3.2版本,发现官网改动也比较大…不同版本自己巴拉下吧,结构虽然变化了,但是内容变的不是很多… 有变动的 都标有: covered later in this document springmvc 自动配置原理 官网上说明 自动配置在Spring的默认设置之上添加了以下功能 Content

1223

SpringBoot 自动配置

SpringBoot 主程序类 自动配置原理 自定义start 运行流程 Spring Boot 自动配置好了SpringMVC SpringBoot 主程序类 /** * @SpringBootApplication 来标注一个主程序类,说明这是一个Spring Boot应用 */ @SpringBootApplication public class Hel...

zhaojianyin 424

SpringBoot——MVC原理

1)、在自动配置很多组件的时候,先看容器中有木有用户自己配置的(@Bean,@Component)如果有就是用用户配置的,如果没有就是用自动配置的,因为底层使用了@ConditionalOnMiss注解来判断,容器中是否已经存在此类配置。2)、如果有些组件可以配置多个,比如视图解析器(ViewResolver)将用户配置的和自己默认的组合起来。继承抽象类既保留了所有的自动配置,也能用我们扩展的配置;类时,就不会导入自动配置的类了,第二步导入的就是这个类。的自动配置和我们的扩展配置都会起作用;

程序猿进阶 2645

SpringBoot自动配置原理

一、简介 使用SpringBoot: 使用IDE的初始化器创建SpringBoot应用,选中我们需要的模块start; SpringBoot已经默认将这些场景配置好了,我们只需要在配置文件中指定少量配置就可以运行起来; 自己编写业务代码; 问题:为什么我们没有像之前那样在配置文件中为SpringMVC配置视图解析器、类型转换器等,程序就可以直接运行? 自动配置原理? 这个场景Spr...

@木南山牙的博客 772

9.SpringMVC自动配置原理

SpringMVC自动配置原理

qq_44840451的博客 303
上一篇: MySQL--慢查询日志、日志分析工具mysqldumpslow
下一篇: SpringMVC--使用hibernate validator数据校验
吴声子夜歌
博客等级 码龄9年 2687粉丝 2267原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值