SpringBoot>23 - 2.0版本WebMvc配置

SpringMVC(看这一篇就够了) MVC全称Model View Controller,是一种设计创建Web应用程序的模式。这三个单词分别代表Web应用程序的三个部分:Model(模型):指数据模型。用于存储数据以及处理用户请求的业务逻辑。在Web应用中,JavaBean对象,业务模型等都属于Model。View(视图):用于展示模型中的数据的,一般为jsp或html文件。Controller(控制器):是应用程序中处理用户交互的部分。接受视图提出的请求,将数据交给模型处理,并将处理后的结果交给视图显示。 阅读详情
前言:

Springboot的starter封装了很多东西,包含了MessageConverter、ViewResolver等web的配置,若需要自定义。在之前1.5版本中自定义javaBean继承WebMvcConfigurerAdapter类,但是在2.0版本中此类标记过时,需要实现WebMvcConfigurer接口实现自定义配置。

个人学习总结:
链接:【springboot、springcloud、docker 等,学习目录】

一、1.5.X版本回顾:

配置类继承WebMvcConfigurerAdapter,重写方法。

/**
 * WebMvcConfigurerAdapter(抽象类):
 * 实现了WebMvcConfigurer接口
 * 自定义web配置,只需重写方法即可
 */
@Configuration
public class MyWebMvcConfigurer extends WebMvcConfigurerAdapter {
    ...
}

// 实现 WebMvcConfigurer 接口
public abstract class WebMvcConfigurerAdapter implements WebMvcConfigurer {
    // 方法没有任何逻辑
    public WebMvcConfigurerAdapter() {
    }
    ...
}

// WebMvcConfigurer 接口
public interface WebMvcConfigurer {
    void configurePathMatch(PathMatchConfigurer var1);
    ...
}

设计技巧: 自定义web配置和WebMvcConfigurer接口之间加上抽象类WebMvcConfigurerAdapter ,该抽象类中没有抽象方法(子类必须重写抽象类中的抽象方法),为方法的空实现。继承抽象类之后就不必要去实现那些我们不需要的方法,自定义配置只需要针对某一个方法重写即可。

2.0.X版本WebMVC自定义配置:

SpringBoot2.0及Spring5.0中WebMvcConfigurerAdapter已被废弃 。推荐直接实现WebMvcConfigurer接口或继承WebMvcConfigurationSupport类。

方式1、继承WebMvcConfigurationSupport类:

public class CustomWebMvcConfig extends WebMvcConfigurationSupport{
    ...
}

此种方式会导致web自动配置失效。
原因:查看源码
在这里插入图片描述

// 没有WebMvcConfigurationSupport类型的bean时改自动配置类才会生效
@ConditionalOnMissingBean({WebMvcConfigurationSupport.class})

解决:重写相应的方法。例如:

@Configuration
public class WebAppConfig extends WebMvcConfigurationSupport {

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(LoginInterceptor()).addPathPatterns("/sys/**")
                .excludePathPatterns("/sys/login.html", "/sys/login/**");
        super.addInterceptors(registry);
    }

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
        super.addResourceHandlers(registry);
    }
}

不推荐此种方式。

方式2、实现 WebMvcConfigurer 接口:
推荐此种配置方式。

1、如下:以拦截器和消息转换器的配置为例

/**
 * @Auther: xf
 * @Date: 2019/1/8 19:25
 * @Description: springboot 2.0  自定义webmvc的配置
 * 方式:
 * 1、继承 WebMvcConfigurationSupport 会导致 webmvc 自动配置失效
 * 2、实现 WebMvcConfigurer 接口  推荐
 */
@Configuration
//public class CustomWebMvcConfig extends WebMvcConfigurationSupport{
public class CustomWebMvcConfig implements WebMvcConfigurer {

    /**
     * 拦截器配置
     * addPathPatterns 用于添加拦截规则
     * excludePathPatterns 用户排除拦截
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
         // 多个拦截器会组成一个拦截器链
         registry.addInterceptor(new MyInterceptor1()).addPathPatterns("/**").excludePathPatterns("/login");
         registry.addInterceptor(new MyInterceptor2()).addPathPatterns("/**");
    }

    /**
     * 消息转换器 -- alibaba 开源的 fastjson
     */
    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {

        /**
         * springboot 2.0 配置FastJson失效,添加如下配置
         *
         * 自定义的 FastJsonHttpMessageConverter 在 MappingJackson2HttpMessageConverter 后面,导致失效
         * 解决:加载FastJsonHttpMessageConverter 前删除 MappingJackson2HttpMessageConverter
         *
         * 参考链接:https://segmentfault.com/a/1190000015975405
         */
        Iterator<HttpMessageConverter<?>> iterator = converters.iterator();
        while(iterator.hasNext()){
            HttpMessageConverter<?> converter = iterator.next();
            if(converter instanceof MappingJackson2HttpMessageConverter){
                iterator.remove();
            }
        }

        // 1、需要定义一个convert转换消息的对象;
        FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
        // 2、添加fastJson的配置信息,比如:是否要格式化返回的json数据;
        FastJsonConfig fastJsonConfig = new FastJsonConfig();
        fastJsonConfig.setSerializerFeatures(
                SerializerFeature.PrettyFormat,
                // list null -> []
                SerializerFeature.WriteNullListAsEmpty,
                SerializerFeature.WriteDateUseDateFormat,
                // String null -> ""
                SerializerFeature.WriteNullStringAsEmpty,
                // Number null -> 0
                SerializerFeature.WriteNullNumberAsZero,
                // Boolean null -> false
                SerializerFeature.WriteNullBooleanAsFalse,
                //禁止循环引用
                SerializerFeature.DisableCircularReferenceDetect
        );

        // 3、处理中文乱码问题
        List<MediaType> fastMediaTypes = new ArrayList<>();
        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
        // 4、在convert中添加配置信息.
        fastJsonHttpMessageConverter.setSupportedMediaTypes(fastMediaTypes);
        fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
        // 5、将convert添加到converters当中.
        converters.add(fastJsonHttpMessageConverter);

        /**
         * WriteNullListAsEmpty  :List字段如果为null,输出为[],而非null
         * WriteNullStringAsEmpty : 字符类型字段如果为null,输出为"",而非null
         * DisableCircularReferenceDetect :消除对同一对象循环引用的问题,默认为false(如果不配置有可能会进入死循环)
         * WriteNullBooleanAsFalse:Boolean字段如果为null,输出为false,而非null
         * WriteMapNullValue:是否输出值为null的字段,默认为false
         */
    }
}

注意: springboot2.0中fastjson消息转换器配置失效的问题。

2、测试:拦截器、消息转换器均有效。

个人微信公众号,谢谢支持!
在这里插入图片描述

ESP32小车DIY:从零搭建无线遥控智能车(附完整代码与避坑指南) 本文详细介绍了如何从零开始DIY一台基于ESP32的无线遥控智能小车。内容涵盖核心硬件选型、电路设计、低延迟ESP-NOW无线通信协议的配置与实战,以及双电机差速控制算法与PWM调速的实现。文章提供了完整的代码示例和关键的避坑指南,旨在帮助开发者快速构建稳定可靠的智能车平台,并为进一步的功能扩展奠定基础。 阅读详情

相关推荐

【论文精读】Latent Diffusion

Latent Diffusion

weixin_44934783的博客 4487

2023官方发布最新SpringMVC

整合2023官方发布最新的springmvc内容,更多功能合特性

qq_58360406的博客 2717

基于TDOA的chan算法(定位算法)

Chan算法原理 TDOA(TDOA,the time differences of arrival,到达时间差),Chan算法是TDOA定位方法的一个很好用的方法。 Chan算法是非递归双曲线方程组解法,具有解析表达式解,主要特点是:在测量误差服从理想高斯分布时,它的定位精度高、计算量小,并且可以通过增加已确定点的数量来提高算法精度。 该算法的推导前提是基于测量误差为零均值高斯随机变量,对于实际环境中误差较大的测量值,比如在有非视距误差的环境下,该算法的性能会有显著下降。二维情况下,可分为只有三个点参与定

CSDN不再更新 2万+

关于SpringMVC基础知识

-----------------------------------SpringWVC---------------------------- -----------------------------------开发步骤 1.导入SpringMVC相关坐标 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</...

lyxluck的博客 1048

别再只会插拔了!深入Linux内核,手把手调试USB热插拔中断(以高通平台为例)

本文深入探讨了Linux内核中USB热插拔中断的调试方法,特别针对高通平台提供了详细的实战指南。从硬件基础到内核机制,再到中断调试工具和常见问题排查,帮助开发者系统性地解决USB设备识别问题。通过监控中断状态、分析处理流程和高级调试技巧,提升USB热插拔的稳定性和性能。

weixin_29161785的博客 433

iOS Certificates, Identifiers & Profiles简介

1. Certificates Certificates是生成开发和生产所需的证书。 2.1 certSigningRequest文件 生成证书前,需要先生成certSigningRequest文件,certSigningRequest文件由【钥匙串访问】生成。 选择菜单【钥匙串访问】,【证书助理】下的【从证书颁发机构请求证书…】 填写【用户电子邮件地址: 】,将【请求是:】的选项改为【储存到磁盘】 输入certSigningRequest文件的文件名,并指定保存位置。 保存certSignin

假装你是大灰狼的专栏 7065

SpringMVC

SpringMVC 是一种基于 Java 的实现 MVC 设计模型的请求驱动类型的轻量级 Web 框架,属于SpringFrameWork的后续产品,已经融合在 Spring Web Flow 中。SpringMVC已经成为目前最主流的MVC框架之一。SpringMVC的作用:作为前端控制器,控制请求的共有行为,在传统的JavaEE技术中,只使用Servlet作为控制器,当每个功能都需要一个servlet程序相似功能也无法分开封装,另外,传统的开发模式也存在其它使用不便利的做法。

2301_78834737的博客 844

ALTERA MAX10 FPGA 串口远程升级实战:从原理到烧录的避坑指南

本文详细解析了ALTERA MAX10 FPGA如何通过串口实现远程升级。文章从工程师实战经验出发,深入剖析了MAX10片内Flash的双镜像备份原理、CONFIG_SEL引脚启动机制,并重点介绍了使用On-Chip Flash IP核进行擦写操作的核心流程。同时,提供了从Quartus工程配置、RPD文件生成、串口协议设计到驱动代码编写的完整避坑指南,旨在帮助开发者稳定、高效地完成远程升级功能部署。

weixin_29197699的博客 280

springboot 接口乱码_SpringBoot>23 - 2.0版本WebMvc配置

前言: Springboot的starter封装了很多东西,包含了MessageConverter、ViewResolver等web的配置,若需要自定义。在之前1.5版本中自定义javaBean继承WebMvcConfigurerAdapter类,但是在2.0版本中此类标记过时,需要实现WebMvcConfigurer接口实现自定义配置。一、1.5.X版本回顾:配置类继承WebMvcConfigu...

weixin_39538607的博客 200

建议收藏:华为海思IC设计笔试题,含解析(附下载)

接触过的部门有麒麟芯片、CPU/GPU,总体面试感觉非常好,规范且认真,第一轮手撕代码状态机+复盘机考题+瞄准几个知识点深挖,时间1hour+;一二轮面试是连着的,所以很累。但是岗位就那么多,在面试的时候,很多同学因为准备不充分,与岗位失之交臂,无缘进入该公司。时序电路有记忆功能,不会产生锁存器,锁存器一般在组合逻辑中case写不全,else写不全,或者敏感列表写不全。

nuoweishizi的博客 3293

正点原子lwIP实战指南——从FreeRTOS移植到网络应用开发

本文详细介绍了如何将轻量级TCP/IP协议栈lwIP移植到FreeRTOS实时操作系统上,并基于正点原子STM32开发板进行网络应用开发。内容涵盖从使用STM32CubeMX快速搭建工程、核心概念解析(RAW/NETCONN/Socket API),到关键的系统适配、驱动实现,并通过TCP Echo服务器和云台控制两个实战案例,手把手指导读者完成从移植到应用开发的全过程,帮助嵌入式开发者快速掌握lwIP在FreeRTOS环境下的稳定部署与开发技巧。

s4t5u6v的博客 1003

SpringBoot之MVC配置(WebMvcConfigurer详解)

Spring MVC是一种常用的Java Web框架,它提供了一种基于MVC模式的开发方式,可以方便地实现Web应用程序。在Spring MVC中,WebMvcConfigurer是一种常用的配置方式,可以允许我们自定义Spring MVC的行为,比如添加拦截器、消息转换器等。在本文中,我们将介绍什么是WebMvcConfigurer,以及如何使用它来自定义Spring MVC的配置。

Gefangenes的博客 4703

OpenClaw使用ClawHub安装skill网络不稳定?Rate limit exceeded报错?试试这个国内高速镜像工具!

使用 ClawHub 安装 Skill 时遇到 🌐 网络不稳、❌ Rate limit 或命令不可用?使用这个镜像工具,轻松解决skill安装问题,⚡

XiaoqiangClub的博客 1264

spring Web Mvc 介绍

/ 异常处理逻辑架构设计原则严格遵循单一职责原则保持控制器轻量化使用DTO进行层间数据传输性能调优要点合理使用连接池配置启用HTTP压缩优化静态资源加载策略安全加固措施定期更新依赖版本实施输入验证和输出编码启用CSP安全策略监控体系建设集成Actuator端点配置日志聚合实现指标可视化通过深入理解 Spring Web MVC 的设计哲学和技术实现,开发者可以构建出既符合传统企业需求,又能适应云原生时代的现代化 Web 应用。

不知道说什么的博客 1503

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

深度学习工具包 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")

CVE-2023-20860 将组件 org.springframework:spring-webmvc 升级至 5.3.26 及以上版本

若依框架,将组件 org.springframework:spring-webmvc 升级至 5.3.26 及以上版本,CVE-2023-20860

tabvla的博客 3589

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

Spring Boot中Spring MVC的基本配置讲解与实战(包括静态资源配置,拦截器配置,文件上传配置及实战 附源码)

Spring Boot中Spring MVC的基本配置讲解与实战(包括静态资源配置,拦截器配置,文件上传配置及实战 附源码)

showswoller的博客 1825

SpringWeb(SpringMVC)详解

SpringWeb(SpringMVC)详解

weixin_71243923的博客 6489

springMVC

触发器具有记忆功能 一个触发器可以存储一位二进制 触发器的分类 1.按电路结构来分 基本RS-FF(锁存器) 同步FF(电平触发) 主从FF(脉冲触发) 边沿FF(边沿触发) CMOS工艺FF 2.按逻辑功能来分 RS JK D T、T' 3.按存储数据的原理来分 静态FF 动态FF 基本RS触发器 S SET 置位 置1 R Clear ......

XUN__MLF的博客 1078

springmvc

Spring MVC已成为主流Java Web框架,基于Spring 的配置案例展示了其核心用法。首先通过Maven引入spring-webmvc等依赖包;其次在web.xml配置DispatcherServlet,并指定springmvc.xml配置文件位置;最后在springmvc.xml中启用关键命名空间。该框架通过注解简化开发,取代Struts 2成为多数团队的选择。示例包含基本配置步骤,注意url-pattern应设为"/"而非"/*",并对静态资源访问做了特别说明。

qq_33406021的博客 691

详解spring-boot-starter-web

是 Spring Boot 提供的用于快速开发 Web 应用的 Starter。它封装了开发 Web 项目所需的常用依赖和自动配置,极大简化了 Web 项目的搭建流程。基于 Spring MVC 的 RESTful Web 服务开发。内嵌 Servlet 容器(Tomcat/Jetty/Undertow)。JSON 数据处理(默认集成 Jackson)。参数校验(Hibernate Validator)。静态资源处理。

onlymscn的博客 1796

SpringMVC新版本(Spring 5.3.0)官网详解(一)

Spring MVC是Spring框架中一个非常基础又核心的理念。笔者相信大多数同学都用过,但是如果被深究起来恐怕还是说不出来什么具体的东西。这篇文章将会统一的说下什么是Spring MVC,以及在较新版本中一个Spring MVC的框架应该怎么去搭建。本篇将会给大家带来一篇纯Java版本的Spring MVC教程。

Smallc0de的博客 1万+

SpringMVC简单介绍与使用

一、SpringMVC介绍,二、SpringMVC作用,三、SpringMVC核心组件,四、SpringMVC快速体验

Alphamilk的博客 782

SpringMVC初阶详解

MVC模式和SpringMVC介绍 MVC : 是一种用于设计创建web应用表现层的模式,主要作用是将视图展示和业务控制代码分离开来 MVC 使用了三种角色来分别处理不同的功能: Model(模型):数据模型(封装对象) View(视图):负责数据的展示(html,jsp) Controller(控制器):负责调度,用于程序业务逻辑处理 MVC架构跟三层架构的关系: MVC把三层架构中的表现层再度进行了分化,分成了控制器、视图、模型。 三层架构的目的是解耦,mvc的目的是实现web系统的

墨鸦的博客 6245

JavaWeb开发(四)4.1——Spring MVC 详解

MVC模式与三层架构、基于注解和XML方式的SpringMVC环境搭建

qq_36216193的博客 1054
上一篇: SpringBoot>22 - 项目打包
下一篇: Java基础、springboot、springcloud、docker系列目录
cp026la
博客等级 码龄8年 65粉丝 86原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值