SpringBoot对于SpringMVC的支持

创建项目

请添加图片描述

版本说明这里使用的 SpringBoot 2.0.0.Release

SpringBoot对于SpringMVC的支持

  在之前的开发中很多场景下使用的是基于xml配置文件或者是Java配置类的方式来进行SpringMVC的配置。一般来讲,初始的步骤如下所示

  • 1、初始化SpringMVC的DispatcherServlet
  • 2、搭建转码过滤器,保证客户端请求进行正确的转码
  • 3、搭建视图解析器(View Resolver),告诉Spring从什么地方查找视图,以及这些视图使用什么语言编写等
  • 4、配置静态资源的位置
  • 5、配置所支持的地域以及资源bundle
  • 6、配置multipart解析器,保证文件上传能够正常工作
  • 7、将Tomcat或者Jetty包含能够在Web服务器上运行应用
  • 8、建立错误页面

  当然不止是上面这些工作。如下图所示,为SpringMVC核心的处理流程。

核心处理流
请添加图片描述

功能流图
请添加图片描述

1.1 分发器和multipart配置

  首先在默认的配置文件中加入如下的一行代码,表示已debug模式运行SpringBoot的应用。

debug=true

配置完成之后会看到控制台会打印出debug信息。

DispatcherServletAutoConfiguration matched:- @ConditionalOnClass found required class 'org.springframework.web.servlet.DispatcherServlet' (OnClassCondition)- found 'session' scope (OnWebApplicationCondition)DispatcherServletAutoConfiguration.DispatcherServletConfiguration matched:- @ConditionalOnClass found required class 'javax.servlet.ServletRegistration' (OnClassCondition)- Default DispatcherServlet did not find dispatcher servlet beans (DispatcherServletAutoConfiguration.DefaultDispatcherServletCondition)DispatcherServletAutoConfiguration.DispatcherServletRegistrationConfiguration matched:- @ConditionalOnClass found required class 'javax.servlet.ServletRegistration' (OnClassCondition)- DispatcherServlet Registration did not find servlet registration bean (DispatcherServletAutoConfiguration.DispatcherServletRegistrationCondition)DispatcherServletAutoConfiguration.DispatcherServletRegistrationConfiguration#dispatcherServletRegistration matched:- @ConditionalOnBean (names: dispatcherServlet; types: org.springframework.web.servlet.DispatcherServlet; SearchStrategy: all) found bean 'dispatcherServlet' (OnBeanCondition)EmbeddedWebServerFactoryCustomizerAutoConfiguration matched:- @ConditionalOnWebApplication (required) found 'session' scope (OnWebApplicationCondition)EmbeddedWebServerFactoryCustomizerAutoConfiguration.TomcatWebServerFactoryCustomizerConfiguration matched:- @ConditionalOnClass found required classes 'org.apache.catalina.startup.Tomcat', 'org.apache.coyote.UpgradeProtocol' (OnClassCondition)ErrorMvcAutoConfiguration matched:- @ConditionalOnClass found required classes 'javax.servlet.Servlet', 'org.springframework.web.servlet.DispatcherServlet' (OnClassCondition)- found 'session' scope (OnWebApplicationCondition)ErrorMvcAutoConfiguration#basicErrorController matched:- @ConditionalOnMissingBean (types: org.springframework.boot.web.servlet.error.ErrorController; SearchStrategy: current) did not find any beans (OnBeanCondition)ErrorMvcAutoConfiguration#errorAttributes matched:- @ConditionalOnMissingBean (types: org.springframework.boot.web.servlet.error.ErrorAttributes; SearchStrategy: current) did not find any beans (OnBeanCondition)ErrorMvcAutoConfiguration.DefaultErrorViewResolverConfiguration#conventionErrorViewResolver matched:- @ConditionalOnBean (types: org.springframework.web.servlet.DispatcherServlet; SearchStrategy: all) found bean 'dispatcherServlet'; @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.web.servlet.error.DefaultErrorViewResolver; SearchStrategy: all) did not find any beans (OnBeanCondition)ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration matched:- @ConditionalOnProperty (server.error.whitelabel.enabled) matched (OnPropertyCondition)- ErrorTemplate Missing did not find error template view (ErrorMvcAutoConfiguration.ErrorTemplateMissingCondition)ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration#beanNameViewResolver matched:- @ConditionalOnMissingBean (types: org.springframework.web.servlet.view.BeanNameViewResolver; SearchStrategy: all) did not find any beans (OnBeanCondition)ErrorMvcAutoConfiguration.WhitelabelErrorViewConfiguration#defaultErrorView matched:- @ConditionalOnMissingBean (names: error; SearchStrategy: all) did not find any beans (OnBeanCondition)GenericCacheConfiguration matched:- Cache org.springframework.boot.autoconfigure.cache.GenericCacheConfiguration automatic cache type (CacheCondition)HttpEncodingAutoConfiguration matched:- @ConditionalOnClass found required class 'org.springframework.web.filter.CharacterEncodingFilter' (OnClassCondition)- found 'session' scope (OnWebApplicationCondition)- @ConditionalOnProperty (spring.http.encoding.enabled) matched (OnPropertyCondition)HttpEncodingAutoConfiguration#characterEncodingFilter matched:- @ConditionalOnMissingBean (types: org.springframework.web.filter.CharacterEncodingFilter; SearchStrategy: all) did not find any beans (OnBeanCondition)HttpMessageConvertersAutoConfiguration matched:- @ConditionalOnClass found required class 'org.springframework.http.converter.HttpMessageConverter' (OnClassCondition)HttpMessageConvertersAutoConfiguration#messageConverters matched:- @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.http.HttpMessageConverters; SearchStrategy: all) did not find any beans (OnBeanCondition)HttpMessageConvertersAutoConfiguration.StringHttpMessageConverterConfiguration matched:- @ConditionalOnClass found required class 'org.springframework.http.converter.StringHttpMessageConverter' (OnClassCondition)MultipartAutoConfiguration matched:- @ConditionalOnClass found required classes 'javax.servlet.Servlet', 'org.springframework.web.multipart.support.StandardServletMultipartResolver', 'javax.servlet.MultipartConfigElement' (OnClassCondition)- found 'session' scope (OnWebApplicationCondition)- @ConditionalOnProperty (spring.servlet.multipart.enabled) matched (OnPropertyCondition)MultipartAutoConfiguration#multipartConfigElement matched:- @ConditionalOnMissingBean (types: javax.servlet.MultipartConfigElement,org.springframework.web.multipart.commons.CommonsMultipartResolver; SearchStrategy: all) did not find any beans (OnBeanCondition)MultipartAutoConfiguration#multipartResolver matched:- @ConditionalOnMissingBean (types: org.springframework.web.multipart.MultipartResolver; SearchStrategy: all) did not find any beans (OnBeanCondition)

  下面就来分析一下DispatcherServletAutoConfiguration配置类

DispatcherServletAutoConfiguration


@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
@Configuration
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass(DispatcherServlet.class)
@AutoConfigureAfter(ServletWebServerFactoryAutoConfiguration.class)
@EnableConfigurationProperties(ServerProperties.class)
public class DispatcherServletAutoConfiguration {

首先会发现它是一个 @Configuration 注解标注的类,说明这是一个典型的Spring配置类。在这个配置类上标注了一个注解 @EnableConfigurationProperties(ServerProperties.class),这个注解表示使用了SpringBoot自动配置原理,对于配置文件与配置类进行了映射,在这里看到向这个配置中注入的自动配置类的 ServerProperties 这里就是在配置文件中以server开头的所有配置。例如在配置文件可以进行端口的设置,访问路径配置

server.port=8080
server.servlet.context-path=/hello

在它的内部有一个静态内部类DispatcherServletConfiguration,这个内部类也是作为一个配置类存在,这里需要注意一个注解 @Conditional 这个注解表示满足条件之后才会向容器中注入对应的组件。这里会看到如果容器中有 DefaultDispatcherServletCondition 这个类才会进行处理。也就是说在这里需要一个默认的DispatcherServlet才会生效

@Configuration
@Conditional(DefaultDispatcherServletCondition.class)
@ConditionalOnClass(ServletRegistration.class)
@EnableConfigurationProperties(WebMvcProperties.class)
protected static class DispatcherServletConfiguration {private final WebMvcProperties webMvcProperties;public DispatcherServletConfiguration(WebMvcProperties webMvcProperties) {this.webMvcProperties = webMvcProperties;}@Bean(name = DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)public DispatcherServlet dispatcherServlet() {DispatcherServlet dispatcherServlet = new DispatcherServlet();dispatcherServlet.setDispatchOptionsRequest(this.webMvcProperties.isDispatchOptionsRequest());dispatcherServlet.setDispatchTraceRequest(this.webMvcProperties.isDispatchTraceRequest());dispatcherServlet.setThrowExceptionIfNoHandlerFound(this.webMvcProperties.isThrowExceptionIfNoHandlerFound());return dispatcherServlet;}@Bean@ConditionalOnBean(MultipartResolver.class)@ConditionalOnMissingBean(name = DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME)public MultipartResolver multipartResolver(MultipartResolver resolver) {// Detect if the user has created a MultipartResolver but named it incorrectlyreturn resolver;}}

第一步首先来看看对于 DefaultDispatcherServletCondition 进行分析

@Order(Ordered.LOWEST_PRECEDENCE - 10)
private static class DefaultDispatcherServletCondition extends SpringBootCondition {//继承父类实现获取匹配结果方法/*** 两个参数* 第一个参数ConditionContext 进行操作的上下文* 第二个参数AnnotatedTypeMetadata 注解类型的元数据*/@Overridepublic ConditionOutcome getMatchOutcome(ConditionContext context,AnnotatedTypeMetadata metadata) {//定义默认的DispatcherServlet信息	ConditionMessage.Builder message = ConditionMessage.forCondition("Default DispatcherServlet");//从配合beanFactory中进行遍历		ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();List<String> dispatchServletBeans = Arrays.asList(beanFactory.getBeanNamesForType(DispatcherServlet.class, false, false));//找到dispatcherServletif (dispatchServletBeans.contains(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)) {return ConditionOutcome.noMatch(message.found("dispatcher servlet bean").items(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME));}if (beanFactory.containsBean(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)) {return ConditionOutcome.noMatch(message.found("non dispatcher servlet bean").items(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME));}if (dispatchServletBeans.isEmpty()) {return ConditionOutcome.match(message.didNotFind("dispatcher servlet beans").atAll());}return ConditionOutcome.match(message.found("dispatcher servlet bean", "dispatcher servlet beans").items(Style.QUOTE, dispatchServletBeans).append("and none is named " + DEFAULT_DISPATCHER_SERVLET_BEAN_NAME));}}

我们知道在使用@Bean注解的时候如果没有指定name属性默认会以方法名为容器中Bean的ID,在上面这类中对容器中的DispatchServlet进行匹配的时候需要满足下面这个Bean的条件。而这个bean的配置正是可以在webMvcProperteis中进行配置的。

@Bean(name = DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)
public DispatcherServlet dispatcherServlet() {DispatcherServlet dispatcherServlet = new DispatcherServlet();dispatcherServlet.setDispatchOptionsRequest(this.webMvcProperties.isDispatchOptionsRequest());dispatcherServlet.setDispatchTraceRequest(this.webMvcProperties.isDispatchTraceRequest());dispatcherServlet.setThrowExceptionIfNoHandlerFound(this.webMvcProperties.isThrowExceptionIfNoHandlerFound());return dispatcherServlet;
}

在其内部还有另外一个内部类DispatcherServletRegistrationConfiguration

@Configuration
@Conditional(DispatcherServletRegistrationCondition.class)
@ConditionalOnClass(ServletRegistration.class)
@EnableConfigurationProperties(WebMvcProperties.class)
@Import(DispatcherServletConfiguration.class)
protected static class DispatcherServletRegistrationConfiguration {private final WebMvcProperties webMvcProperties;private final MultipartConfigElement multipartConfig;public DispatcherServletRegistrationConfiguration(WebMvcProperties webMvcProperties,ObjectProvider<MultipartConfigElement> multipartConfigProvider) {this.webMvcProperties = webMvcProperties;this.multipartConfig = multipartConfigProvider.getIfAvailable();}@Bean(name = DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME)@ConditionalOnBean(value = DispatcherServlet.class, name = DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)public DispatcherServletRegistrationBean dispatcherServletRegistration(DispatcherServlet dispatcherServlet) {DispatcherServletRegistrationBean registration = new DispatcherServletRegistrationBean(dispatcherServlet,this.webMvcProperties.getServlet().getPath());registration.setName(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME);registration.setLoadOnStartup(this.webMvcProperties.getServlet().getLoadOnStartup());if (this.multipartConfig != null) {registration.setMultipartConfig(this.multipartConfig);}return registration;}}
	@Order(Ordered.LOWEST_PRECEDENCE - 10)private static class DefaultDispatcherServletCondition extends SpringBootCondition {@Overridepublic ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {ConditionMessage.Builder message = ConditionMessage.forCondition("Default DispatcherServlet");ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();List<String> dispatchServletBeans = Arrays.asList(beanFactory.getBeanNamesForType(DispatcherServlet.class, false, false));if (dispatchServletBeans.contains(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)) {return ConditionOutcome.noMatch(message.found("dispatcher servlet bean").items(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME));}if (beanFactory.containsBean(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)) {return ConditionOutcome.noMatch(message.found("non dispatcher servlet bean").items(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME));}if (dispatchServletBeans.isEmpty()) {return ConditionOutcome.match(message.didNotFind("dispatcher servlet beans").atAll());}return ConditionOutcome.match(message.found("dispatcher servlet bean", "dispatcher servlet beans").items(Style.QUOTE, dispatchServletBeans).append("and none is named " + DEFAULT_DISPATCHER_SERVLET_BEAN_NAME));}}@Order(Ordered.LOWEST_PRECEDENCE - 10)private static class DispatcherServletRegistrationCondition extends SpringBootCondition {@Overridepublic ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {ConfigurableListableBeanFactory beanFactory = context.getBeanFactory();ConditionOutcome outcome = checkDefaultDispatcherName(beanFactory);if (!outcome.isMatch()) {return outcome;}return checkServletRegistration(beanFactory);}private ConditionOutcome checkDefaultDispatcherName(ConfigurableListableBeanFactory beanFactory) {List<String> servlets = Arrays.asList(beanFactory.getBeanNamesForType(DispatcherServlet.class, false, false));boolean containsDispatcherBean = beanFactory.containsBean(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME);if (containsDispatcherBean && !servlets.contains(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME)) {return ConditionOutcome.noMatch(startMessage().found("non dispatcher servlet").items(DEFAULT_DISPATCHER_SERVLET_BEAN_NAME));}return ConditionOutcome.match();}private ConditionOutcome checkServletRegistration(ConfigurableListableBeanFactory beanFactory) {ConditionMessage.Builder message = startMessage();List<String> registrations = Arrays.asList(beanFactory.getBeanNamesForType(ServletRegistrationBean.class, false, false));boolean containsDispatcherRegistrationBean = beanFactory.containsBean(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME);if (registrations.isEmpty()) {if (containsDispatcherRegistrationBean) {return ConditionOutcome.noMatch(message.found("non servlet registration bean").items(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME));}return ConditionOutcome.match(message.didNotFind("servlet registration bean").atAll());}if (registrations.contains(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME)) {return ConditionOutcome.noMatch(message.found("servlet registration bean").items(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME));}if (containsDispatcherRegistrationBean) {return ConditionOutcome.noMatch(message.found("non servlet registration bean").items(DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME));}return ConditionOutcome.match(message.found("servlet registration beans").items(Style.QUOTE, registrations).append("and none is named " + DEFAULT_DISPATCHER_SERVLET_REGISTRATION_BEAN_NAME));}private ConditionMessage.Builder startMessage() {return ConditionMessage.forCondition("DispatcherServlet Registration");}}

在Spring中往往会通过 @Order 注解来声明优先级,可以看到上面的内容对于两个静态内部类都做了是优先级的配置。在其中还有一个比较重要的注解值得关注 @AutoConfigureAfter(ServletWebServerFactoryAutoConfiguration.class) 对于这些注解来说都是为了进一步的优化配置顺序细节处理。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://xiahunao.cn/news/2803903.html

如若内容造成侵权/违法违规/事实不符,请联系瞎胡闹网进行投诉反馈,一经查实,立即删除!

相关文章

C++的string容器->基本概念、构造函数、赋值操作、字符串拼接、查找和替换、字符串比较、字符存取、插入和删除、子串

#include<iostream> using namespace std; #include <string> //string的构造函数 /* -string(); //创建一个空的字符串 例如: string str; -string(const char* s); //使用字符串s初始化 -string(const string& str); //使…

前端JS学习(二):BOM、DOM对象与事件

Web API基本认知 Web API 的作用&#xff1a;使用JS去操作html和浏览器 Web API 的分类&#xff1a;DOM(网页文档对象模型)、BOM(浏览器对象模型) BOM BOM的全称是 Browser Object Model&#xff0c;浏览器对象模型。也就是 JavaScript 将浏览器的各个组成部分封装成了对象&…

修改单据转换规则后保存报错提示

文章目录 修改单据转换规则后保存报错提示 修改单据转换规则后保存报错提示

区块链与Solidity详细介绍及基本语法使用

一、区块链简介 区块链是一种分布式数据库技术&#xff0c;它以块的形式存储数据&#xff0c;并通过加密算法确保数据的安全性。每个块包含一系列交易&#xff0c;并通过哈希值与前一个块相连接&#xff0c;形成一个链式结构。这种结构使得数据难以被篡改&#xff0c;因为任何对…

2024.2.22 C++QT 作业

思维导图 练习题 1>完善对话框&#xff0c;点击登录对话框&#xff0c;如果账号和密码匹配&#xff0c;则弹出信息对话框&#xff0c;给出提示”登录成功“&#xff0c;提供一个Ok按钮&#xff0c;用户点击Ok后&#xff0c;关闭登录界面&#xff0c;跳转到其他界面。如果账…

线程池的基础使用和执行策略

什么是线程池 线程池&#xff0c;字面意思就是一个创建线程的池子&#xff0c;它的特点就是&#xff0c;在使用线程之前&#xff0c;就一次性把多个线程创建好&#xff0c;放到"池”当中。后面需要执行任务的时候&#xff0c;直接从"线程池"当中通过线程执行。…

通俗易懂分析:Vite和Webpack的区别

1、对项目构建的理解 先从浏览器出发&#xff0c; 浏览器是由浏览器内核和JS引擎组成&#xff1b;浏览器内核编译解析html代码和css代码&#xff0c;js引擎编译解析JavaScript代码&#xff1b;所以从本质上&#xff0c;浏览器只能识别运行JavaScript、CSS、HTML代码。 而我们在…

MATLAB环境下基于短时傅里叶变换和Rényi熵的脑电信号和语音信号分析

傅里叶变换是不能很好的反映信号在时域的某一个局部范围的频谱特点的&#xff0c;这一点很可惜。因为在许多实际工程中&#xff0c;人们对信号在局部区域的特征是比较关心的&#xff0c;这些特征包含着十分有用的信息。这类信号因为在时域(或者是空间域)上具有突变的非稳定性和…

Java基于SSM+JSP的超市进销库存管理系统

博主介绍&#xff1a;✌程序员徐师兄、7年大厂程序员经历。全网粉丝12w、csdn博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精彩专栏推荐订阅&#x1f447;…

深入了解Git

1.1 Git 的工作流程简介 克隆 Git 资源作为工作目录 在克隆的资源上添加或修改文件 如果其他人修改了&#xff0c;你可以更新资源 在提交前查看修改 提交修改 在修改完成后&#xff0c;如果发现错误&#xff0c;可以撤回提交并再次修改并提交 1.2 Git 工作区、暂存区和版…

自存 angular material design 表单输入框lable右对齐样式

单个输入框的文字lable放输入框左边实现 material design 的组件库示例没有文字描述放左边的样式 ,所以mat-lable并没有放在mat-form-field中 <div class"input-container col-6"><mat-label>商品售价<span class"text-error">*</spa…

【springBoot】springAOP

AOP的概述 AOP是面向切面编程。切面就是指某一类特定的问题&#xff0c;所以AOP也可以理解为面向特定方法编程。AOP是一种思想&#xff0c;拦截器&#xff0c;统一数据返回和统一异常处理是AOP思想的一种实现。简单来说&#xff1a;AOP是一种思想&#xff0c;对某一类事务的集…

基于springboot+vue的中小型医院网站(前后端分离)

博主主页&#xff1a;猫头鹰源码 博主简介&#xff1a;Java领域优质创作者、CSDN博客专家、阿里云专家博主、公司架构师、全网粉丝5万、专注Java技术领域和毕业设计项目实战&#xff0c;欢迎高校老师\讲师\同行交流合作 ​主要内容&#xff1a;毕业设计(Javaweb项目|小程序|Pyt…

TDesign Vue Next Starter中后台项目的生产环境部署与CSP内容安全策略、CORS跨源资源共享和服务后端开发

TDesign Vue Next Starter中后台项目的生产环境部署与CSP内容安全策略、CORS跨源资源共享和服务后端开发 目录 TDesign Vue Next Starter中后台项目的生产环境部署与CSP内容安全策略、CORS跨源资源共享和服务后端开发 一、TDesign Vue Next Starter中后台项目模板 1.1、项目…

Ubuntu20.04 查看系统版本号

目录 uname -auname -vlsb_release -acat /etc/issuecat /proc/version uname -a 查看系统发行版本号和操作系统版本 uname -v 查看版本号 lsb_release -a 查看发行版本信息 cat /etc/issue 查看系统版本 cat /proc/version 查看内核的版本号

vivado FSM Components

Vivado合成功能 •同步有限状态机&#xff08;FSM&#xff09;组件的特定推理能力。 •内置FSM编码策略&#xff0c;以适应您的优化目标。 •FSM提取默认启用。 •使用-fsm_extraction off可禁用fsm提取。 FSM描述 Vivado综合支持Moore和Mealy中的有限状态机&#xff08;…

ROX amine,Rhodamine X amine,可和羧酸等官能团反应

​您好&#xff0c;欢迎来到新研之家 文章关键词&#xff1a;Rhodamine X amine, ROX amine &#xff0c;Rhodamine X amine&#xff0c; ROX NH2&#xff0c;氨基ROX &#xff0c;ROX氨基&#xff0c;Rhodamine X氨基 一、基本信息 【产品简介】&#xff1a;ROX can also b…

C++的deque容器->基本概念、构造函数、赋值操作、大小操作、插入和删除、数据存取、排序

#include<iostream> using namespace std; #include <deque> //deque构造函数 void printDeque(const deque<int>& d) { for (deque<int>::const_iterator it d.begin(); it ! d.end(); it) { //*it 100; 容器中的数据不可以修…

DiceCTF 2024 -- pwn

baby-talk 题目给了 Dockerfile&#xff0c;但由于笔者 docker 环境存在问题启动不起来&#xff0c;所以这里用虚拟机环境做了&#xff08;没错&#xff0c;由于不知道远程 glibc 版本&#xff0c;所以笔者远程也没打通&#xff09;笔者本地环境为 glibc 2.31-0ubuntu9.9。然后…

开发技术-Java 获取集合中元素下标并移动至指定位置

1. 说明 某些业务需要特定的元素在列表的最后或者指定位置展示。 2. 代码 import lombok.AllArgsConstructor; import lombok.Data;import java.util.*; import java.util.stream.Collectors; import java.util.stream.IntStream;Data AllArgsConstructor class Student {St…