<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[hsg_happyLearning的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/hsg_happyLearning</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; hsg_happyLearning]]></copyright><item><title><![CDATA[SpringCloud之OpenFeign高级用法]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/156239453</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/156239453</guid><author>hsg_happyLearning</author><pubDate>Wed, 24 Dec 2025 18:53:01 +0800</pubDate><description><![CDATA[Springboot和SpringCloud的版本如下</</</</</</</</</</</</</</引入OpenFeign相关依赖</</</</</</将服务注册到Nacos或Consul这些过程省略，下面介绍一下OpenFeign的高级用法。]]></description><category></category></item><item><title><![CDATA[IDEA全局设置以及实用的配置]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/155982334</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/155982334</guid><author>hsg_happyLearning</author><pubDate>Tue, 16 Dec 2025 15:33:10 +0800</pubDate><description><![CDATA[在使用IDEA开发时，如果想进行全局设置，而不是每次打开或新建项目都要重新设置，可以在打开IDEA时就进行设置，而不是进入到项目里面之后再设置，如下图所示：常用的IDEA设置。]]></description><category></category></item><item><title><![CDATA[IDEA Maven设置所有项目生效]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/155489610</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/155489610</guid><author>hsg_happyLearning</author><pubDate>Tue, 02 Dec 2025 11:41:13 +0800</pubDate><description><![CDATA[在使用IDEA中配置Maven时，我们一般需要设置Maven的setting.xml文件路径，当我们打开了项目，在项目中设置Maven配置文件路径时，只对当前项目生效，如果重新打开或创建了新的Maven项目，还是会读取默认路径的Maven配置，如果想在IDEA中全局设置Maven配置文件路径，对所有项目都生效，需要在打开IDEA的时候就进行设置。设置之后，当我们再创建或导入Maven项目，Maven配置文件就会是我们设置的路径了。]]></description><category></category></item><item><title><![CDATA[sentinel踩坑记录]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/155442153</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/155442153</guid><author>hsg_happyLearning</author><pubDate>Mon, 01 Dec 2025 09:59:31 +0800</pubDate><description><![CDATA[本地启动springboot微服务和sentinel之后，微服务成功注册到了sentinel上，但是微服务中的web接口在sentinel的簇点链路中没有(sentinel会自动把微服务中的web接口定义成资源，不需要在web接口上加@SentinelResource注解)，因为sentinel和微服务都是在本地启动的，不会是网段和防火墙的问题，定位了很长时间，无意中发现。]]></description><category></category></item><item><title><![CDATA[nacos使用的注意事项]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/155227014</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/155227014</guid><author>hsg_happyLearning</author><pubDate>Tue, 25 Nov 2025 10:25:58 +0800</pubDate><description><![CDATA[1、创建命名空间时，命名空间ID最好手动填写，不要自动生成，最好和命名空间名保持一致，springboot配置文件中的config.namespance写的是命名空间ID。]]></description><category></category></item><item><title><![CDATA[SpringBoot加载resources目录下的配置文件]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/154348535</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/154348535</guid><author>hsg_happyLearning</author><pubDate>Mon, 03 Nov 2025 14:33:41 +0800</pubDate><description><![CDATA[在SpringBoot项目中，我们可能会需要根据配置类型将配置数据放到不同的配置文件中模块化配置，例如将数据库配置放到db.properties，redis配置放到redis.properties，es配置放到es.properties，方便维护，在 Spring Boot 2.4 及以上版本中，引入了 spring.config.import 属性，用于导入额外的配置文件或配置类。optional: 关键字表示如果配置服务器不可用，Spring Boot应用仍然可以启动，但不会加载配置服务器中的配置。]]></description><category></category></item><item><title><![CDATA[批量数据入库工具类]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/153396265</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/153396265</guid><author>hsg_happyLearning</author><pubDate>Thu, 16 Oct 2025 10:47:44 +0800</pubDate><description><![CDATA[当我们使用insert往数据库中批量添加数据时，需要考虑一次批量新增的数据量，因为sql语句的长度是有限制的，当批量新增的数据量太大，比如一次新增一万条数据或者表的字段太多，会导致sql超长报错。为了防止sql超长，我们可以每次只往数据库插入200条数据，当数据量较大时，可以循环插入，为此，可以写一个批量插入的工具类进行处理。statisticsDao就是Mybatis的Mapper。Mysql可以使用以下命令查询sql语句支持的最大字符数。]]></description><category></category></item><item><title><![CDATA[Springboot获取bean的工具类]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/151835010</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/151835010</guid><author>hsg_happyLearning</author><pubDate>Thu, 18 Sep 2025 17:44:05 +0800</pubDate><description><![CDATA[在代码中，我们可以通过如下方式获取到bean(假如Spring容器中有一个UserService bean)]]></description><category></category></item><item><title><![CDATA[Springboots上传文件的同时传递参数用对象接收]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/151794429</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/151794429</guid><author>hsg_happyLearning</author><pubDate>Wed, 17 Sep 2025 15:04:54 +0800</pubDate><description><![CDATA[2、接收入参的对象，只用@Validated修饰，起参数校验的作用。1、上传的文件参数用@RequestParam修饰。]]></description><category></category></item><item><title><![CDATA[Keepalived实现Nginx(Docker)高可用]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/124776104</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/124776104</guid><author>hsg_happyLearning</author><pubDate>Sat, 14 May 2022 23:12:13 +0800</pubDate><description><![CDATA[Keepalived实现Nginx(Docker)高可用
1、在两台服务器上准备Docker的Nginx容器
随便拉一个版本的nginx
docker pull nginx:1.12.2

创建nginx容器
docker run -d --name nginx:1.12.2

创建/mydata/nginx/conf目录，并将nginx容器中的nginx.conf文件拷贝到该路径下，修改目录权限
mkdir -p /mydata/nginx/conf
docker cp nginx:/etc/nginx/]]></description><category></category></item><item><title><![CDATA[ELK部署以及使用]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/124137139</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/124137139</guid><author>hsg_happyLearning</author><pubDate>Tue, 12 Apr 2022 23:16:08 +0800</pubDate><description><![CDATA[ELK部署以及使用
ELK实际上是三个工具的集合，Elasticsearch + Logstash + Kibana，这三个工具组合形成了一套实用、易用的监控架构，很多公司利用它来搭建可视化的海量日志分析平台。
ELK部署
Docker
docker是目前非常流行的容器化技术，可以非常方便快捷的部署服务，解决项目部署时的环境问题，实现“一次封装，到处运行”，我们采用docker可以快速的部署ELK。
Docker-compose
Docker Compose是一个用于定义和运行多个docker容器应用的工具]]></description><category></category></item><item><title><![CDATA[Redis集群搭建]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123978826</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123978826</guid><author>hsg_happyLearning</author><pubDate>Tue, 05 Apr 2022 22:19:05 +0800</pubDate><description><![CDATA[Redis集群搭建
搭建redis集群的场景方式有：

客户端分区，在客户端根据hash计算将数据保存到那个redis节点，该方案的代表有redis sharding。优点是不使用第三方中间件，分区逻辑可控，配置简单，节点之间无关联，容易线性扩展，灵活性高；缺点是客户端无法动态增删节点，需要自行维护分发逻辑，节点之间无连接共享，会造成连接浪费(需要连接多个redis)，而且一旦有节点宕机，会导致服务不可用。
代理分区，类似于mysql使用sharding-proxy，客户端连接redis代理，由代理实现分区]]></description><category></category></item><item><title><![CDATA[Mysql主从复制配置]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123834034</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123834034</guid><author>hsg_happyLearning</author><pubDate>Tue, 29 Mar 2022 22:21:11 +0800</pubDate><description><![CDATA[Mysql主从复制配置
准备两台服务器，服务器的IP地址分别为192.168.56.101、192.168.56.102，在两台服务器上分别使用Docker部署Mysql，Master部署在192.168.56.101服务器，Slave部署在192.168.56.102服务器，实现Mysql主从同步功能。
一、Docker部署Mysql


Master节点
sudo docker run -p 3306:3306 --name mysql-master \
-v /mydata/mysql/master/]]></description><category></category></item><item><title><![CDATA[11、队列]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123193501</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123193501</guid><author>hsg_happyLearning</author><pubDate>Mon, 28 Feb 2022 21:58:56 +0800</pubDate><description><![CDATA[队列在日常工作中使用的没有集合多，但是同样特别重要，我们平时使用到的线程池、读写锁、消息队列等等技术和框架，底层原理都是队列J，队列是很多高级 API 的基础，学好队列，对自己深入 Java 学习非常重要。AVA中常用的队列有LinkedBlockingQueue、ArrayBlockingQueue、SynchronousQueue、DelayQueue，下面简单介绍下这四种队列各种的特别以及应用场景。本文只做队列的入门级学习，不具体研究源码。
Queue接口
Queue接口是队列最基础的接口，基本所有的]]></description><category></category></item><item><title><![CDATA[10、并发集合类]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123158417</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123158417</guid><author>hsg_happyLearning</author><pubDate>Sat, 26 Feb 2022 23:39:24 +0800</pubDate><description><![CDATA[ArrayList、LinkedList等List类集合，以及HashMap、TreeMap、LinkedHashMap等Map类集合，都是线程不安全的，当作为共享变量时，在多线程并发环境下存在线程安全问题，为此，JAVA提供了线程安全的集合，List类集合有Vector、Collections.synchronizedList、CopyOnWriteArrayList，Map类集合有Hashtable、Collections.synchronizedMap、ConcurrentHashMap。
List类]]></description><category></category></item><item><title><![CDATA[自定义注解校验List集合数据]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123140633</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123140633</guid><author>hsg_happyLearning</author><pubDate>Fri, 25 Feb 2022 20:35:42 +0800</pubDate><description><![CDATA[实现功能：自定义注解实现对信息封装类中的List集合中的元素信息校验，并支持通过注解属性指定是否允许集合为空。
自定义注解
@Target(FIELD)
@Retention(RUNTIME)
@Constraint(validatedBy = StringListValidator.class)
public @interface StringList {
    // 检验失败时的错误提示信息
    String message() default "字符串格式错误";

    // 集合为空时的错]]></description><category></category></item><item><title><![CDATA[10、并发集合类]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123123334</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123123334</guid><author>hsg_happyLearning</author><pubDate>Thu, 24 Feb 2022 23:22:59 +0800</pubDate><description><![CDATA[ArrayList、LinkedList等List类集合，以及HashMap、TreeMap、LinkedHashMap等Map类集合，都是线程不安全的，当作为共享变量时，在多线程并发环境下存在线程安全问题，为此，JAVA提供了线程安全的集合，List类集合有Vector、Collections.synchronizedList、CopyOnWriteArrayList，Map类集合有Hashtable、Collections.synchronizedMap、ConcurrentHashMap。
List类]]></description><category></category></item><item><title><![CDATA[09、HashSet、TreeSet、LinkedHashSet 源码解析]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123013392</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123013392</guid><author>hsg_happyLearning</author><pubDate>Sat, 19 Feb 2022 00:39:02 +0800</pubDate><description><![CDATA[Set类集合通过组合不同的Map，实现各种Set的功能，HashSet组合的是HashMap，TreeSet组合的是TreeMap，而LinkedHashSet则是继承HashSet，HashSet和TreeSet之所以采用组合而不是继承的方式，是因为：

继承表示父子类是同一个事物，而 Set 和 Map 本来就是想表达两种事物，所以继承不妥，而且 Java 语法限制，子类只能继承一个父类，使用继承后续难以扩展；
组合更加灵活，可以任意的组合现有的基础类，并且可以在基础类方法的基础上进行扩展、编排等，而且]]></description><category></category></item><item><title><![CDATA[08、Map源码面试题]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123012707</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/123012707</guid><author>hsg_happyLearning</author><pubDate>Fri, 18 Feb 2022 23:23:56 +0800</pubDate><description><![CDATA[1、  Map 数据结构类问题
1、 说一说 HashMap 底层数据结构
HashMap的底层数据结构是数组+链表+红黑树，之所以采用这种结构，是因为数组通过下标查询的速度很快，方便快速查找，时间复杂度是O(1)，数组的默认大小是16；当向HashMap中put()元素时，会先根据key计算数组的下标index(计算方式是(n-1) &amp; hash，n是数组的长度，hash是key的hashcode)，通过index获取数组的值，如果值不为null就说明hash冲突了，会接着寻找以该数组元素为头节点]]></description><category></category></item><item><title><![CDATA[07、集合之TreeMap和LinkedHashMap]]></title><link>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/122992884</link><guid>https://blog.youkuaiyun.com/hsg_happyLearning/article/details/122992884</guid><author>hsg_happyLearning</author><pubDate>Thu, 17 Feb 2022 22:03:20 +0800</pubDate><description><![CDATA[07、集合之TreeMap和LinkedHashMap
TreeMap
TreeMap的底层数据接口是红黑树，由于红黑树的左小右大的特性，所以TreeMap中的元素会自动根据key进行排序，在初始化TreeMap时，可以传自定义的排序器comparator，如果没有传排序器会默认使用key的compareTo()方法进行比较。因为底层使用的时红黑树，所以TreeMap的get()、put()、remove()方法的时间复杂度都是O(log(n))。
排序的两种方式

实现comparable接口，通过com]]></description><category></category></item></channel></rss>