SpringBoot学习笔记上

文章目录

  • 1 SpringBoot
    • 1.1 SpringBoot介绍
    • 1.2 SpringBoot创建的三种方式
    • 1.3@SpringBootApplication注解
    • 1.4 SpringBoot的配置文件
    • 1.5多环境配置
    • 1.6 使用jsp
    • 1.7 ComnandLineRunner 接口 , ApplcationRunner接口
  • 2 Web组件
    • 2.1 拦截器
    • 2.2 Servlet
    • 2.3 过滤器Filter
    • 2.4 字符集过滤器
  • 3 ORM 操作 MySQL
      • 第一种方式 : @Mapper
      • 第二种方式 @MapperScan
      • 第三种方式: Mapper文件和Mapper接口分开管理
      • 事务

1 SpringBoot

  1. 为什么要使用 Spring Boot
    因为Spring, SpringMVC 需要使用的大量的配置文件 (xml文件)
    还需要配置各种对象,把使用的对象放入到spring容器中才能使用对象
    需要了解其他框架配置规则。
  2. SpringBoot 就相当于 不需要配置文件的Spring+SpringMVC。 常用的框架和第三方库都已经配置好了。
    拿来就可以使用了。
  3. SpringBoot开发效率高,使用方便多了

1.1 SpringBoot介绍

SpringBoot是Spring中的一个成员, 可以简化Spring,SpringMVC的使用。 他的核心还是IOC容器。

特点:

  • Create stand-alone Spring applications
    创建spring应用

  • Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
    内嵌的tomcat, jetty , Undertow

  • Provide opinionated ‘starter’ dependencies to simplify your build configuration
    提供了starter起步依赖,简化应用的配置。
    比如使用MyBatis框架 , 需要在Spring项目中,配置MyBatis的对象 SqlSessionFactory , Dao的代理对象
    在SpringBoot项目中,在pom.xml里面, 加入一个 mybatis-spring-boot-starter依赖

  • Automatically configure Spring and 3rd party libraries whenever possible

    尽可能去配置spring和第三方库。叫做自动配置(就是把spring中的,第三方库中的对象都创建好,放到容器中, 开发人员可以直接使用)

  • Provide production-ready features such as metrics, health checks, and externalized configuration

    提供了健康检查, 统计,外部化配置

  • Absolutely no code generation and no requirement for XML configuration

    不用生成代码, 不用使用xml,做配置

1.2 SpringBoot创建的三种方式

  1. 使用地址: https://start.spring.io
    请添加图片描述

  2. 修改地址: https://start.springboot.io

  3. 使用 maven 向导创建项目
    创建一个普通 maven 项目
    修改项目的目录
    在这里插入图片描述
    添加 Spring Boot 依赖

    <dependencies>
    	<!--web起步依赖(SpringMVC功能)-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
    	<plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    

    创建启动类:加入@SpringBootApplication 注解

    package com.yrgx;
    
    @SpringBootApplication
    public class Application {
        public static void main(String[] args) {
            SpringApplication.run(Application.class, args);
        }
    }
    

1.3@SpringBootApplication注解

@SpringBootApplication
复合注解:由
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan 组成

  1. @SpringBootConfiguration

    @Configuration
    public @interface SpringBootConfiguration {
        @AliasFor(
            annotation = Configuration.class
        )
        boolean proxyBeanMethods() default true;
    }
    
    说明:使用了@SpringBootConfiguration注解标注的类,可以作为配置文件使用的,
        可以使用@Bean声明对象,注入到容器
    
  2. @EnableAutoConfiguration

    启用自动配置, 把java对象配置好,注入到spring容器中。例如可以把mybatis的对象创建好,放入到容器中

  3. @ComponentScan

    @ComponentScan 组件扫描器,扫描注解,根据注解的功能创建对象,给属性赋值等等。
    默认扫描的包: @ComponentScan所在的类所在的包和子包。    
    

1.4 SpringBoot的配置文件

配置文件名称: application

扩展名有: properties( k=v) ; yml ( k: v)

使用application.properties, application.yml

例1:application.properties设置 端口和上下文

#设置端口号
server.port=8082
#设置访问应用上下文路径, contextpath
server.servlet.context-path=/myboot

例2: application.yml

server:
  port: 8083
  servlet:
    context-path: /myboot2

1.5多环境配置

有开发环境, 测试环境, 上线的环境。
每个环境有不同的配置信息, 例如端口, 上下文件, 数据库url,用户名,密码等等
使用多环境配置文件,可以方便的切换不同的配置。
使用方式: 创建多个配置文件, 名称规则: application-环境名称.properties(yml)

创建开发环境的配置文件: application-dev.properties

# 开发使用的配置文件
server.port=8081
server.servlet.context-path=/mydev

创建测试者使用的配置: application-test.properties

# 测试使用的配置文件
server.port=9001
server.servlet.context-path=/mytest

application.properties

# 激活使用开发的测试环境
spring.profiles.active=dev

1.6 使用jsp

SpringBoot不推荐使用jsp ,而是使用模板技术代替jsp

使用jsp需要配置:

  1. 加入一个处理jsp的依赖。 负责编译jsp文件

    <!--引入 Spring Boot 内嵌的 Tomcat 对 JSP 的解析包,不加解析不
    了 jsp 页面-->
    <!--如果只是使用 JSP 页面,可以只添加该依赖-->
    <dependency>
    	 <groupId>org.apache.tomcat.embed</groupId>
    	 <artifactId>tomcat-embed-jasper</artifactId>
    </dependency>
    
  2. 如果需要使用servlet, jsp,jstl的功能

    <!--如果要使用 servlet 必须添加该以下两个依赖-->
    <!-- servlet 依赖的 jar 包-->
    <dependency>
    	 <groupId>javax.servlet</groupId>
    	 <artifactId>javax.servlet-api</artifactId>
    </dependency>
    <!-- jsp 依赖 jar 包-->
    <dependency>
    	 <groupId>javax.servlet.jsp</groupId>
    	 <artifactId>javax.servlet.jsp-api</artifactId>
    	 <version>2.3.1</version>
    </dependency>
    <!--如果使用 JSTL 必须添加该依赖-->
    <!--jstl 标签依赖的 jar 包 start-->
    <dependency>
    	 <groupId>javax.servlet</groupId>
    	 <artifactId>jstl</artifactId>
    </dependency>
    
  3. 在main目录下创建一个存放jsp的目录,一般叫做webapp
    ​ index.jsp

  4. 需要在pom.xml指定jsp文件编译后的存放目录。
    META-INF/resources

    <resources>
    	<resource>
    		<!--源文件位置-->
    		<directory>src/main/webapp</directory>
    		<!--指定编译到META-INF/resource,该目录不能随便写-->
    		<targetPath>META-INF/resources</targetPath>
    		<!--指定要把哪些文件编译进去,**表示 webapp 目录及子目录,*.*表示所有文件-->
    		<includes>
    			<include>**/*.*</include>
    		</includes>
    	</resource>
    </resources>
    
  5. 在application.propertis文件中配置视图解析器

    #配置 SpringMVC 的视图解析器
    #其中:/相当于 src/main/webapp 目录
    spring.mvc.view.prefix=/
    spring.mvc.view.suffix=.jsp
    
  6. 创建Controller, 访问jsp

1.7 ComnandLineRunner 接口 , ApplcationRunner接口

这两个接口都 有一个run方法。 执行时间在容器对象创建好后, 自动执行run()方法。

可以完成自定义的在容器对象创建好的一些操作

@FunctionalInterface
public interface CommandLineRunner {
    void run(String... args) throws Exception;
}

@FunctionalInterface
public interface ApplicationRunner {
    void run(ApplicationArguments args) throws Exception;
}

2 Web组件

2.1 拦截器

拦截器是SpringMVC中一种对象,能拦截器对Controller的请求。
拦截器框架中有系统的拦截器, 还可以自定义拦截器。 实现对请求预先处理。

在SpringMVC中实现自定义拦截器:

  1. 创建类实现SpringMVC框架的HandlerInterceptor接口
    public interface HandlerInterceptor {
     default boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
         return true;
     }
    
     default void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable ModelAndView modelAndView) throws Exception {
     }
    
     default void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, @Nullable Exception ex) throws Exception {
     }
    }
    
  2. 需在SpringMVC的配置文件中,声明拦截器
    <mvc:interceptors>
    	<mvc:interceptor>
        	<mvc:path="url" />
            <bean class="拦截器类全限定名称"/>
        </mvc:interceptor>
    </mvc:interceptors>
    

SpringBoot中注册拦截器:

public class LoginInterceptor implements HandlerInterceptor {
    /**
     * @param handler 被拦截器的控制器对象
     * @return boolean
     *      true:请求能被Controller处理
     *      false:请求被截断
     */
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        System.out.println("执行了LoginInterceptor的preHandle方法");
        return true;
    }
}

@Configuration
public class MyAppConfig implements WebMvcConfigurer {

    //添加拦截器对象, 注入到容器中
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        //创建拦截器对象
        HandlerInterceptor interceptor = new LoginInterceptor();

        //指定拦截的请求uri地址
        String path []= {"/user/**"};
        //指定不拦截的地址
        String excludePath  [] = {"/user/login"};
        registry.addInterceptor(interceptor)
                .addPathPatterns(path)
                .excludePathPatterns(excludePath);

    }
}

2.2 Servlet

在SpringBoot框架中使用Servlet对象。

使用步骤:

  1. 创建Servlet类。 创建类继承HttpServlet
  2. 注册Servlet ,让框架能找到Servlet

a. 创建自定义Servlet

//创建Servlet类
public class MyServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
       //使用HttpServletResponse输出数据,应答结果
        resp.setContentType("text/html;charset=utf-8");
        PrintWriter out  = resp.getWriter();
        out.println("===执行的是Servlet==");
        out.flush();
        out.close();
    }
}

b. 注册Servlet

@Configuration
public class WebApplictionConfig {

    //定义方法, 注册Servlet对象
    @Bean
    public ServletRegistrationBean servletRegistrationBean(){
        //public ServletRegistrationBean(T servlet, String... urlMappings)
        //第一个参数是 Servlet对象, 第二个是url地址

        //ServletRegistrationBean bean = new ServletRegistrationBean( new MyServlet(),"/myservlet");


        ServletRegistrationBean bean = new ServletRegistrationBean();
        bean.setServlet( new MyServlet());
        bean.addUrlMappings("/login","/test"); // <url-pattern>

        return bean;
    }
}

2.3 过滤器Filter

Filter是Servlet规范中的过滤器,可以处理请求, 对请求的参数, 属性进行调整。 常常在过滤器中处理字符编码

在框架中使用过滤器:

  1. 创建自定义过滤器类
  2. 注册Filter过滤器对象

自定义过滤器

public class MyFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("执行了MyFilter,doFilter ");
        filterChain.doFilter(servletRequest,servletResponse);
    }
}

注册Filter

@Configuration
public class WebApplicationConfig {

    @Bean
    public FilterRegistrationBean filterRegistrationBean(){
        FilterRegistrationBean bean  = new FilterRegistrationBean();
        bean.setFilter( new MyFilter());
        bean.addUrlPatterns("/user/*");
        return bean;
    }
}

2.4 字符集过滤器

CharacterEncodingFilter : 解决post请求中乱码的问题
在SpringMVC框架, 在web.xml 注册过滤器。 配置他的属性。

第一种方式:
使用步骤:

  1. 配置字符集过滤器

    @Configuration
    public class WebSystemConfig {
    
        //注册Filter
        @Bean
        public FilterRegistrationBean filterRegistrationBean(){
            FilterRegistrationBean reg = new FilterRegistrationBean();
    
            //使用框架中的过滤器类
            CharacterEncodingFilter filter  = new CharacterEncodingFilter();
            //指定使用的编码方式
            filter.setEncoding("utf-8");
            //指定request , response都使用encoding的值
            filter.setForceEncoding(true);
    
            reg.setFilter(filter);
            //指定 过滤的url地址
            reg.addUrlPatterns("/*");
            
            return reg;
        }
    }
    
  2. 修改application.properties文件, 让自定义的过滤器起作用

    #SpringBoot中默认已经配置了CharacterEncodingFilter。 编码默认ISO-8859-1
    #设置enabled=false 作用是关闭系统中配置好的过滤器, 使用自定义的CharacterEncodingFilter
    server.servlet.encoding.enabled=false
    

第二种方式

修改application.properties文件

#让系统的CharacterEncdoingFilter生效
server.servlet.encoding.enabled=true
#指定使用的编码方式
server.servlet.encoding.charset=utf-8
#强制request,response都使用charset属性的值
server.servlet.encoding.force=true

3 ORM 操作 MySQL

在这里插入图片描述

使用MyBatis框架操作数据, 在SpringBoot框架集成MyBatis

使用步骤:

  1. mybatis起步依赖 : 完成mybatis对象自动配置, 对象放在容器中

    <dependencies>
        <!--web的起步依赖-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <!--mybatis的起步依赖-->
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>2.3.0</version>
        </dependency>
        <!--mysql驱动-->
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!--测试-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    
  2. pom.xml 指定把src/main/java目录中的xml文件包含到classpath中

    <!--resources插件-->
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.xml</include>
            </includes>
        </resource>
    </resources>
    
  3. 创建实体类Student

    package com.yrgdcx.model;
    
    public class Student {
        private Integer id;
        private String name;
        private Integer age;
        // get、set、toString方法
    
  4. 创建Mapper接口 StudentMapper , 创建一个查询学生的方法

    package com.yrgdcx.mapper;
    
    @Mapper
    public interface StudentMapper {
        Student selectById(@Param("stuId") Integer id);
    }
    
  5. 创建Mapper接口对应的Mapper文件, xml文件, 写sql语句

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE mapper
            PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
            "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
    
    <mapper namespace="com.yrgdcx.mapper.StudentMapper">
        <!--定义sql语句-->
        <select id="selectById" resultType="com.yrgdcx.model.Student">
            select id,name,age from student where id = #{stuId}
        </select>
    </mapper>
    
  6. 创建Service层对象, 创建StudentService接口和他的实现类。 去调用Mapper对象的方法。完成数据库的操作

    package com.yrgdcx.service;
    public interface StudentService {
        Student queryStudent(Integer id);
    }
    
    package com.yrgdcx.service.impl;
    @Service
    public class StudentServiceImpl implements StudentService {
        @Resource
        private StudentMapper studentMapper;
    
        @Override
        public Student queryStudent(Integer id) {
            Student student = studentMapper.selectById(id);
            return student;
        }
    }
    
  7. 创建Controller对象,访问Service。

    package com.yrgdcx.controller;
    
    @Controller
    public class StudentController {
        @Resource
        private StudentService studentService;
        @RequestMapping("/student/query")
        @ResponseBody
        public String queryStudent(Integer id){
            Student student = studentService.queryStudent(id);
            return student.toString();
        }
    }
    
  8. 写application.properties文件,配置数据库的连接信息。

    server.port=8081
    server.servlet.context-path=/orm
    
    # 连接数据库
    spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
    spring.datasource.url=jdbc:mysql://localhost:3306/springbootdb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8
    spring.datasource.username=root
    spring.datasource.password=root
    

第一种方式 : @Mapper

@Mapper:放在Mapper接口的上面, 每个接口都需要使用这个注解。

/**
 * @Mapper:告诉MyBatis这是Mapper接口,创建此接口的代理对象。
 *     位置:在类的上面
 */
@Mapper
public interface StudentMapper {

    Student selectById(@Param("stuId") Integer id);
}

第二种方式 @MapperScan

/**
 * @MapperScan: 找到Mapper接口和Mapper文件
 *     basePackages:Mapper接口所在的包名
 */
@SpringBootApplication
@MapperScan(basePackages = {"com.yrgdcx.mapper"})
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }
}

第三种方式: Mapper文件和Mapper接口分开管理

把Mapper文件放在resources目录下

  1. 在resources目录中创建子目录 (自定义的) , 例如mapper

  2. 把mapper文件放到 mapper目录中

  3. 在application.properties文件中,指定mapper文件的目录

    #指定mapper文件的位置
    mybatis.mapper-locations=classpath:mapper/*.xml
    
  4. 在pom.xml中指定 把resources目录中的文件 , 编译到目标目录中

    <!--resources插件-->
    <resources>
       <resource>
          <directory>src/main/resources</directory>
          <includes>
             <include>**/*.*</include>
          </includes>
       </resource>
    </resources>
    

事务

Spring框架中的事务:

  1. 管理事务的对象: 事务管理器(接口, 接口有很多的实现类)

​ 例如:使用Jdbc或mybatis访问数据库,使用的事务管理器:DataSourceTransactionManager

  1. 声明式事务: 在xml配置文件或者使用注解说明事务控制的内容

​ 控制事务: 隔离级别,传播行为, 超时时间

  1. 事务处理方式:

    1. Spring框架中的@Transactional

    2. aspectj框架可以在xml配置文件中,声明事务控制的内容

SpringBoot中使用事务: 上面的两种方式都可以。

1)在业务方法的上面加入@Transactional , 加入注解后,方法有事务功能了。

2)在主启动类的上面 ,加入@EnableTransactionManager

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

gpt3官网中文版-人工智能软件chat gpt安装

GPT-3&#xff08;Generative Pre-trained Transformer 3&#xff09;是一种自然语言处理模型&#xff0c;由OpenAI研发而成。它是GPT系列模型的第三代&#xff0c;也是目前最大、最强大的自然语言处理模型之一&#xff0c;集成了1750亿个参数&#xff0c;具有广泛的使用场景&a…

Flutter Row 实例 —— 新手礼包

大家好&#xff0c;我是 17。 本文在 3.31 日全站综合热榜第一。 新手礼包一共 3 篇文章&#xff0c;每篇都是描述尽量详细&#xff0c;实例讲解&#xff0c;包会&#xff01; Flutter Row 实例 —— 新手礼包Flutter TextField UI 实例 —— 新手礼包Flutter TextField 交…

靠近用户侧和数据,算网融合实现极致协同

游弋自如的生产力&#xff0c;在边缘。IMMENSE、36氪&#xff5c;作者 1846年1月&#xff0c;纽约。 一行长短不一的电码顺着通讯线路飞往130公里开外的费城&#xff0c;这是华尔街的巨头们首次使用电报传输讯息&#xff0c;更具有金钱意味的是&#xff0c;电力通讯的成功&am…

【蓝桥杯集训·周赛】AcWing 第96场周赛

文章目录第一题 AcWing 4876. 完美数一、题目1、原题链接2、题目描述二、解题报告1、思路分析2、时间复杂度3、代码详解第二题 AcWing 4877. 最大价值一、题目1、原题链接2、题目描述二、解题报告1、思路分析2、时间复杂度3、代码详解第三题 AcWing 4878. 维护数组一、题目1、原…

路由策略实验

运行OSPF协议 [R1]ospf 1 router-id 1.1.1.1 [R1-ospf-1]area 0 [R1-ospf-1-area-0.0.0.0]network 192.168.12.1 0.0.0.0 [R1-ospf-1-area-0.0.0.0]network 192.168.13.1 0.0.0.0 [R2]ospf 1 router-id 2.2.2.2 [R2-ospf-1]area 0 [R2-ospf-1-area-0.0.0.0]network 192.168.…

抖音seo矩阵系统源码搭建技术+二开开源代码定制部署

抖音已经成为了当今最为流行的短视频平台之一&#xff0c;拥有着庞大的用户群体和海量的视频资源。对于一些商家或者运营者来说&#xff0c;如何从这些视频资源中挖掘出有效的信息&#xff0c;进而提升自己的品牌、产品或者内容的曝光度&#xff0c;就成为了一个非常重要的问题…

一次通过.frm和.ibd恢复mysql数据表的过程

1、导出.frm和.ibd文件 2、安装Mysql的Utilities 3、执行命令&#xff08;实际恢复的表&#xff09; mysqlfrm --diagnostic ./stat_vehicle_mileage.frm4、复制Sql&#xff0c;添加ROW_FORMATCOMPACT&#xff08;需要检测生成的Sql语句是否可用&#xff09; CREATE TABLE …

Android开发-Android常用组件-ProgressBar进度条

4.8 ProgressBar进度条 常用属性 android:max 进度条的最大值 android:progress 进度条已完成进度值 android:progressDrawable 设置轨道对应的Drawable对象 android:indeterminate 如果设置成true&#xff0c;则进度条不精确显示进度 android:indeterminateDrawable …

YOLO算法改进指南【算法解读篇】:2.如何训练自己的数据集

我们接着上一篇文章配置完YOLOv5需要的环境后,今天我们试着用YOLOv5训练自己的数据。(在开始本教程前,记得先跑一遍入门篇,确保环境是正常的) 有图有真相,先看看我的运行结果 【YOLOv5 源码地址】 🚀 我的环境: 语言环境:Python3.8编译器:PyCharm深度学习环境: to…

2021蓝桥杯真题格点(填空题) C语言/C++

问题描述 如果一个点(x,y) 的两维坐标都是整数, 即 x∈Z 且 y∈Z, 则称这个点为 一个格点。 如果一个点 (x,y) 的两维坐标都是正数, 即 x>0 且 y>0, 则称这个点在 第一象限。 请问在第一象限的格点中, 有多少个点(x,y) 的两维坐标乘积不超过 2021 , 即x⋅y≤2021 。 掟…

c#之反射详解

总目录 文章目录总目录一、反射是什么&#xff1f;1、C#编译运行过程2、反射与元数据3、反射的优缺点二、反射的使用1、反射相关的类和命名空间1、System.Type类的应用2、System.Activator类的应用3、System.Reflection.Assembly类的应用4、System.Reflection.Module类的应用5、…

SpringBoot 整合RabbitMq 自定义消息监听容器来实现消息批量处理

SpringBoot 整合RabbitMq 自定义消息监听容器来实现消息批量处理前言添加依赖配置文件编写监听器创建SimpleRabbitListenerContainerFactory发送消息前言 RabbitMQ是一种常用的消息队列&#xff0c;Spring Boot对其进行了深度的整合&#xff0c;可以快速地实现消息的发送和接收…

PCB模块化设计16——RS232,RS485接口模块PCB布局布线设计规范

目录PCB模块化设计16——RS232&#xff0c;RS485接口模块PCB布局布线设计规范RS232接口模块1、接口概述2、接口电路 原理图的EMC设计3、连接器设计4、线缆设计5、RS-232常规管脚定义&#xff1a;6、RS-232知识要点RS485接口模块1、原理图设计方案1、RS485接口6KV防雷电路设计方…

c语言程序笔记(1)

C语言笔记&#xff08;1&#xff09;——B站翁恺视频 程序框架 #include <stdio.h> int main() {//printf("hello world!\n");return 0; }1、变量与常量。 例子1&#xff1a; #include <stdio.h> int main() {printf("1234%d",1234);return …

图解LeetCode——合并两个有序链表

如果你喜欢这篇文章的话&#xff0c;请给作者点赞关注哟&#xff0c;你的支持是我不断前进的动力&#xff01; 目录 题目描述&#xff1a; 解法&#xff1a; 完整代码&#xff1a; 结果 题目链接&#xff1a;力扣 题目描述&#xff1a; 将两个升序链表合并为一个新的 升序…

2017世界互联网领先成果来了 光量子计算机

演讲者&#xff1a;陆朝阳中国科学技术大学教授 发布了世界上首台超越早期经典计算机的光量子计算机 陆朝阳&#xff1a;很高兴向大家报告中国科学院在量子计算这个领域取得的基础性的研究成果。 我们知道50多年以来摩尔定律一直见证着计算机的更新换代&#xff0c;之前每过18个…

【新2023Q2模拟题JAVA】华为OD机试 - 绘图机器

最近更新的博客 华为od 2023 | 什么是华为od,od 薪资待遇,od机试题清单华为OD机试真题大全,用 Python 解华为机试题 | 机试宝典【华为OD机试】全流程解析+经验分享,题型分享,防作弊指南华为od机试,独家整理 已参加机试人员的实战技巧本篇题解:绘图机器 题目 绘图机器的绘…

读书笔记-纳瓦尔宝典-2023.04.01

重点 财富 如何构造高价值信息 判断力 何为幸福 启发 最近看了这本书的大部分内容&#xff0c;感悟颇多&#xff0c;及时记录下来。 因为是快速阅读&#xff0c;还未做深入思考和实践&#xff0c;但对总体的内容有一个大致把握&#xff0c;未来会结合行动反复阅读和思考&…

python画爱心代码

前几天在网上看到了一个画爱心的教程&#xff0c;就是在 Python里面画一个爱心&#xff0c;但是我在网上找到的代码不是很好用&#xff0c;所以我就自己写了一遍。 首先我们先创建一个新的 python文件。新建一个 python文件夹&#xff0c;将我们之前的那个 python文件夹复制到这…

蓝桥杯·3月份刷题集训Day03

本篇博客旨在记录自已打卡蓝桥杯3月份刷题集训&#xff0c;同时会有自己的思路及代码解答希望可以给小伙伴一些帮助。本人也是算法小白&#xff0c;水平有限&#xff0c;如果文章中有什么错误之处&#xff0c;希望小伙伴们可以在评论区指出来&#xff0c;共勉&#x1f4aa;。 文…