<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Spring on 极客老墨</title>
    <link>https://blog.hankmo.com/categories/spring/</link>
    <description>Recent content in Spring on 极客老墨</description>
    <generator>Hugo -- 0.138.0</generator>
    <language>zh-cn</language>
    <lastBuildDate>Wed, 12 Aug 2020 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.hankmo.com/categories/spring/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Spring扩展原理</title>
      <link>https://blog.hankmo.com/posts/tech/spring-extension/</link>
      <pubDate>Wed, 12 Aug 2020 00:00:00 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-extension/</guid>
      <description>Spring Bean后置处理器用于bean创建对象初始化前后进行拦截工作，因此它是spring容器扩展必不可少的组件。</description>
    </item>
    <item>
      <title>给Spring中注册Bean的几种方式</title>
      <link>https://blog.hankmo.com/posts/tech/methods-to-add-beans-to-spring/</link>
      <pubDate>Thu, 07 May 2020 00:00:00 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/methods-to-add-beans-to-spring/</guid>
      <description>给Spring中添加Bean的这些方式，你都弄明白了吗？</description>
    </item>
    <item>
      <title>Spring IoC容器实现原理</title>
      <link>https://blog.hankmo.com/posts/tech/spring-ioc-container/</link>
      <pubDate>Wed, 08 Apr 2020 00:00:00 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-ioc-container/</guid>
      <description>IOC容器两个核心的接口为 BeanFacotry 和 ApplicationContext，前者提供容器管理Bean的基本功能，后者则扩展 BeanFactory，提供了容器级的强大功能，如国际化支持、资源加载、事件、应用上下文环境等。</description>
    </item>
    <item>
      <title>Spring Bean自动扫描原理</title>
      <link>https://blog.hankmo.com/posts/tech/spring-component-auto-scan/</link>
      <pubDate>Tue, 10 Mar 2020 00:00:00 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-component-auto-scan/</guid>
      <description>Spring 基于注解的Bean自动扫描是由后置处理器 `ConfigurationClassPostProcessor` 来实现的，本篇将讨论Spring自动扫描的原理。</description>
    </item>
    <item>
      <title>Spring IoC容器启动过程</title>
      <link>https://blog.hankmo.com/posts/tech/spring-ioc-start/</link>
      <pubDate>Thu, 06 Feb 2020 00:00:00 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-ioc-start/</guid>
      <description>Spring容器启动过程非常复杂，但是其核心流程都离不开 refresh 方法，所以该方法是spring最重要的一个方法，本文讨论spring容器的启动过程。</description>
    </item>
    <item>
      <title>使用Springboot开发websocket程序(四)——使用RabbitMQ作为STOMP消息代理</title>
      <link>https://blog.hankmo.com/posts/tech/springboot-websocket-chatroom-with-rabbitmq/</link>
      <pubDate>Tue, 12 Nov 2019 18:13:24 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/springboot-websocket-chatroom-with-rabbitmq/</guid>
      <description>基于内存的stomp消息代理能够满足单应用需求，引入外部stomp消息代理解决了多应用之间的websocket消息传递需求。不同的消息中间件，都会按照stomp规范定义自身的destination支持。开发者需要明白两个点：订阅者订阅了什么destination，发送者发送到什么destination，这两个地址的匹配规则是什么。</description>
    </item>
    <item>
      <title>使用Springboot开发websocket程序(三)——基于子协议STOMP的web聊天室</title>
      <link>https://blog.hankmo.com/posts/tech/springboot-websocket-chatroom-with-stomp/</link>
      <pubDate>Sat, 02 Nov 2019 14:36:19 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/springboot-websocket-chatroom-with-stomp/</guid>
      <description>WebSocket RFC定义了子协议的使用规范。在握手阶段，客户端和服务端使用Sec-WebSocket-Protocol请求头来通知彼此使用子协议，即更高级的、应用级的协议。当然，也可以不使用子协议，但是客户端和服务端仍然需要定义消息的格式。使用更规范的通用消息协议，更能让应用程序开发和维护变得简单。STOMP就是这样的一个消息协议，Spring框架提供了对其的支持。</description>
    </item>
    <item>
      <title>使用Springboot开发websocket程序(二)——基于原生websocket的web聊天室</title>
      <link>https://blog.hankmo.com/posts/tech/springboot-websocket-chatroom/</link>
      <pubDate>Fri, 01 Nov 2019 16:22:25 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/springboot-websocket-chatroom/</guid>
      <description>websocket是一种由HTML5定义的浏览器和服务器保持长连接的通信协议，可以进行实时数据交换。WebSocket客户端除了支持Html5的浏览器外，还包括各大语言提供的WebSocket实现，比如Java中Spring框架的实现，从而在没有浏览器时也能进行websocket通信。HTML5中WebSocket API请看这里。服务端中，Java定义Java WebSocket API标准 JSR-356，Java主流容器都已经支持websocket。</description>
    </item>
    <item>
      <title>使用Springboot开发websocket程序(一)——什么是websocket</title>
      <link>https://blog.hankmo.com/posts/tech/springboot-websocket-intro/</link>
      <pubDate>Fri, 01 Nov 2019 11:51:49 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/springboot-websocket-intro/</guid>
      <description>在互联网飞速发展的当代，浏览器和服务器之间的实时通信已经越来越重要，传统的HTTP协议难以解决实时通信的需求。因此，由HTML5定义的websocket协议应运而生。WebSocket是HTML5定义的浏览器与服务器实时通信的协议，它基于HTTP协议来完成与服务器的握手。目前，主流浏览器都已经支持websocket，如果浏览器不支持，也可以使用SocketJS来模拟websocket的API。WebSocket已经被广泛应用在网页游戏、视频直播、电商等等场景。</description>
    </item>
    <item>
      <title>SpringBoot自定义日志配置</title>
      <link>https://blog.hankmo.com/posts/tech/springboot-custom-log/</link>
      <pubDate>Fri, 06 Sep 2019 18:41:26 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/springboot-custom-log/</guid>
      <description>当系统出现问题时，先从表现分析问题远远不够，要快速、准确地分析并定位问题原因，日志就是一个非常重要且必不可少的手段。Java而言，日志框架有很多，常用的有Common-logging、Java自带的Logging、Log4J、Logback等。另外，还有一个Slf4J的框架，主要目的是将这些框架进行整合。</description>
    </item>
    <item>
      <title>Spring AMQP消息转换</title>
      <link>https://blog.hankmo.com/posts/tech/spring-amqp-message-convert/</link>
      <pubDate>Mon, 17 Jun 2019 17:35:15 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-amqp-message-convert/</guid>
      <description>们介绍了如果使用Spring AMQP注解来实现消息发送和监听，示例都是使用的默认的消息转换器，即SimpleMessageConverter，它只能处理byte[]、String、java序列化对象(实现了Serializable接口的对象)。通常，不推荐使用Java序列化，因为它存在与Java对象强耦合、依赖java语言等缺点，Spring AMQP也提供了其他的消息转换方式，在本篇，我们将重点来看看如果将消息序列化为JSON格式。</description>
    </item>
    <item>
      <title>Spring AMQP注解的使用</title>
      <link>https://blog.hankmo.com/posts/tech/spring-amqp-guide-by-annotation/</link>
      <pubDate>Thu, 13 Jun 2019 17:15:31 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-amqp-guide-by-annotation/</guid>
      <description>上一篇 Spring AMQP简介和使用，我们介绍了Spring AMQP的一些基本要素和概念，也通过一些示例代码介绍了消息的发送和接收，但是都是使用的原始编码方式来实现，并不依赖Spring环境。其实，Spring AMQP也支持使用注解的方式来进行异步接收消息，极大的简化了编码。要使用注解，首先需要在Spring应用环境中。</description>
    </item>
    <item>
      <title>Spring AMQP简介和使用</title>
      <link>https://blog.hankmo.com/posts/tech/spring-amqp-intro/</link>
      <pubDate>Wed, 05 Jun 2019 09:42:47 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-amqp-intro/</guid>
      <description>Spring AMQP 是 Spring 对 AMQP 协议的封装和扩展，提供了消息发送和接收的模板。Spring AMQP由spring-amqp和spring-rabbit两个模块组成。spring-amqp模块位于org.springframework.amqp.core包，它的目标是提供不依赖于任何特定AMQP代理实现或客户端库的通用抽象；而spring-rabbit是spring-amqp通用抽象的具体实现，目前仅提供了rabbitmq的实现。</description>
    </item>
    <item>
      <title>Spring boot集成quartz并实现任务调度</title>
      <link>https://blog.hankmo.com/posts/tech/spring-boot-quartz-guide/</link>
      <pubDate>Tue, 22 Jan 2019 16:13:13 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-boot-quartz-guide/</guid>
      <description>spring boot与quartz集成，自定义JobFactory实现自动依赖注入，进行数据持久化。</description>
    </item>
    <item>
      <title>Spring boot工程Feign请求时Get请求无法传递body的问题</title>
      <link>https://blog.hankmo.com/posts/tech/spring-boot-feign-get-with-body/</link>
      <pubDate>Tue, 22 Jan 2019 15:54:21 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-boot-feign-get-with-body/</guid>
      <description>同RestTemplate类似，Feign默认情况下也使用的是JDK原生的http请求，同时也支持OkHttp、HttpClient等框架。默认情况下，原生Http请求不允许Get请求传递body，如果传递了body数据，会将当前请求转为Post请求，而实际上我们后台接收的是Get请求，所以抛出上边的异常，所以我们需要换成能够支持的HttpClient。</description>
    </item>
    <item>
      <title>使用Spring的RestTemplate发送GET请求，并支持传递Request body参数</title>
      <link>https://blog.hankmo.com/posts/tech/spring-resttemplate-get-with-body/</link>
      <pubDate>Wed, 31 Oct 2018 18:32:31 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-resttemplate-get-with-body/</guid>
      <description>使用RestTemplate发送GET请求，默认使用的JDK实现，不支持传递body参数，可以改为Apache的httpclient包，只需对HttpComponentsClientHttpRequestFactory进行扩展，让GET扩展自HttpEntityEnclosingRequestBase即可。</description>
    </item>
    <item>
      <title>Spring Boot参数验证（下）——Bean Validation在Web中的应用</title>
      <link>https://blog.hankmo.com/posts/tech/spring-boot-validation-2/</link>
      <pubDate>Fri, 12 Oct 2018 16:52:20 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-boot-validation-2/</guid>
      <description>Spring Boot的Web Starter已经加入了Bean Validation(JSR303)的依赖，可以直接使用。在使用时，只需在需要校验的方法上加上@Valid或者@Validated注解即可，如果需要编码自定义校验结果，则在校验的参数后加上BindingResult参数，注意对应关系；否则，为了模块化需要，也可以屏蔽校验失败业务逻辑，编写全局校验器，校验失败自动返回JSON校验结果即可。</description>
    </item>
    <item>
      <title>Spring boot全局异常处理和自定义异常页面</title>
      <link>https://blog.hankmo.com/posts/tech/spring-boot-global-exception-process/</link>
      <pubDate>Wed, 10 Oct 2018 17:39:20 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-boot-global-exception-process/</guid>
      <description>Spring boot提供了默认的异常处理机制，但是难以满足业务需要，一般需要编码来实现自己的业务处理机制。可以使用ContrllerAdvisor和ExceptionHandler注解来定义异常处理逻辑，要自定义异常页面，只需定义页面并放到error目录下即可。</description>
    </item>
    <item>
      <title>Spring Boot参数验证（上）——Bean Validation及其Hibernate实现</title>
      <link>https://blog.hankmo.com/posts/tech/spring-boot-validation-1/</link>
      <pubDate>Wed, 10 Oct 2018 15:15:34 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-boot-validation-1/</guid>
      <description>Bean Validation，是JCP(Java Community Process)定义的标准化的JavaBean校验API，基于注解，并且具有良好的易用性和扩展性，1.0版本定义为JSR 303，而现在发布了2.0版本，定义为JSR 380。Hibernate Validator是JSR 380的一种标准实现，同时还对其进行了扩展，如增加了部分验证约束。目前，最新的稳定版本为6.0.13.Final。</description>
    </item>
    <item>
      <title>Spring Cloud服务注册中心Eureka高可用</title>
      <link>https://blog.hankmo.com/posts/tech/springcloud-eureka-cluster/</link>
      <pubDate>Thu, 16 Aug 2018 17:03:18 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/springcloud-eureka-cluster/</guid>
      <description>对于Eureka而言，其本身是支持多节点集群的。其原理大致如下：服务注册中心的多个实例彼此互相注册，形成注册中心的集群，同时对外提供服务，即使其中一个挂掉，其他实例仍然可以对外提供服务，从而保证了高可用。</description>
    </item>
    <item>
      <title>Spring Cloud服务注册中心Eureka</title>
      <link>https://blog.hankmo.com/posts/tech/springcloud-eureka-standalone/</link>
      <pubDate>Wed, 15 Aug 2018 16:48:42 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/springcloud-eureka-standalone/</guid>
      <description>Eureka，字面意思即&amp;#34;发现&amp;#34;之意，是Netflix下开源的服务治理（注册、发现等）中间件。Spring Cloud Eureka在其基础上进行了二次封装，添加了自动化配置等功能，使其成为Spring Cloud微服务体系中核心的服务治理方案之一。</description>
    </item>
    <item>
      <title>Spring Cloud Config之配置集成化</title>
      <link>https://blog.hankmo.com/posts/tech/springcloud-config-center-with-git/</link>
      <pubDate>Tue, 14 Aug 2018 17:35:26 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/springcloud-config-center-with-git/</guid>
      <description>Spring Cloud Config是一款配置集中管理的组件，它提供了分布式系统的客户端和服务端外部化配置支持，由git(也支持svn、本地文件系统等)存储库支持的集中式外部配置管理，实现了配置的外部化存储。</description>
    </item>
    <item>
      <title>Spring Cloud简介</title>
      <link>https://blog.hankmo.com/posts/tech/springcloud-intro/</link>
      <pubDate>Fri, 20 Jul 2018 17:13:10 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/springcloud-intro/</guid>
      <description>Spring Cloud是一套构建于Spring boot之上的微服务框架，它整合了大部分微服务实施所需的组件，并提供了默认实现，使得复杂的微服务实施变得简单化。Spring Cloud是一整套微服务解决方案，相比于dubbo等框架而言，不仅出生于Spring大家族，而且更新频繁，发展特别快，社区也很活跃，对于实施微服务的小型公司而言，使用Spring Cloud不仅能够快速实施微服务，而且其已经考虑微服务的各个方面，从而极大的节约了开发成本，提高了生产力。</description>
    </item>
    <item>
      <title>Spring Boot JPA使用详解</title>
      <link>https://blog.hankmo.com/posts/tech/spring-boot-jpa-guide/</link>
      <pubDate>Wed, 27 Jun 2018 18:08:47 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-boot-jpa-guide/</guid>
      <description>JPA是Java Persistence API的简称，中文名Java持久层API，是JDK 5.0注解或XML描述对象－关系表的映射关系，并将运行期的实体对象持久化到数据库中。本文介绍了Spring boot JPA的用法，包括核心接口和类介绍，查询创建，投影、分页查询、条件查询用法等。</description>
    </item>
    <item>
      <title>SpringBoot-工程结构、配置文件以及打包</title>
      <link>https://blog.hankmo.com/posts/tech/springboot-project-overview/</link>
      <pubDate>Thu, 07 Jun 2018 17:43:26 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/springboot-project-overview/</guid>
      <description>Spring Boot默认以jar方式来打包运行程序，与传统war不同的是，Spring Boot规定了web项目的配置文件、静态资源和模板存放位置，同时也提供了可执行jar包的目录规范和打包插件。通常，我们不需要更改Spring Boot的默认配置，如果有特殊需求，同样可以简单的修改application.properties配置项来实现自定义，例如自定义日志、自定义参数、随机参数、自定义WEB文件存放目录等。</description>
    </item>
    <item>
      <title>Spring Boot之基础入门</title>
      <link>https://blog.hankmo.com/posts/tech/spring-boot-intro/</link>
      <pubDate>Tue, 22 May 2018 18:56:09 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-boot-intro/</guid>
      <description>Spring Boot是Spring的开源项目，其目的是让开发者可以简单、快速地使用Spring框架创建生产级的应用，其目的不是为了替换Spring，而是简化Spring的使用。Spring Boot可以看做是对Spring框架的二次封装，不过，在封装的同时也还提供了许多高级功能。</description>
    </item>
    <item>
      <title>Spring事务管理四：声明式事务</title>
      <link>https://blog.hankmo.com/posts/tech/spring-declarative-transaction/</link>
      <pubDate>Thu, 08 Mar 2018 17:34:51 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-declarative-transaction/</guid>
      <description>可以从传播机制、隔离级别、是否只读、事务超时、回滚规则等方面来描述事务。Spring提供了xml和注解两者事务声明方式：采用xml：需要使用tx命名空间，好处是在xml中完成事务定义，代码中不需要做任何事务相关的编码；但是，事务控制的方法名称需要遵循一定的规则，一遍Spring能够匹配到并为其加入事务通知。采用注解：xml仅需一行配置，其他的事务控制都可以通过编码加上注解实现，而且对方法名称没有要求；如果整个应用不需要事务控制，取消xml配置即可。</description>
    </item>
    <item>
      <title>Spring事务管理三：编程式事务</title>
      <link>https://blog.hankmo.com/posts/tech/spring-programming-transaction/</link>
      <pubDate>Thu, 08 Mar 2018 15:50:47 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-programming-transaction/</guid>
      <description>Spring提供了TransactionTemplate工具类，可以方便地让开发人员手动的编程实现事务控制。编程式事务虽然可以精确控制事务，但是事务控制代码必须侵入业务逻辑代码中，耦合度高，后期难以维护。一般而言，不需要精确控制事务，所以采用的更多的是Spring的声明式事务。</description>
    </item>
    <item>
      <title>Spring事务管理二：Spring事务管理器</title>
      <link>https://blog.hankmo.com/posts/tech/spring-transaction-manage/</link>
      <pubDate>Wed, 07 Mar 2018 21:33:52 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-transaction-manage/</guid>
      <description>Spring并不支持管理事务，而是委托给第三方事务管理机制来完成事务控制，Spring顶层提供事务管理核心接口PlatformTransactionManager，事务管理器均是该接口的实现。如果没有合适的事务管理器或者需要支持分布式事务控制，则可以使用全局事务管理器：JTA事务管理器。</description>
    </item>
    <item>
      <title>Spring事务管理一：Spring事务简介</title>
      <link>https://blog.hankmo.com/posts/tech/spring-transaction-intro/</link>
      <pubDate>Wed, 07 Mar 2018 21:20:39 +0000</pubDate>
      <guid>https://blog.hankmo.com/posts/tech/spring-transaction-intro/</guid>
      <description>在软件开发领域，全有或全无的操作被称为事务（transaction）。事物允许将几个操作组合成一个要么全部发生要么全部不发生的工作单元。发生和不发生两者只能选择其一，而不可能两者都选择。事务确保了数据和资源免于处在不一致的状态。事务必须具备ACID特性，在Spring中，除了编程来精确控制事务，还可以使用AOP来配置低耦合度的声明式事务控制。</description>
    </item>
  </channel>
</rss>
