个人博客网:https://wushaopei.github.io/    (你想要这里多有)

一、Spring 整合Activemq

1、所需jar包


  1. <dependencies>
  2. <dependency>
  3. <groupId>org.apache.activemq</groupId>
  4. <artifactId>activemq-all</artifactId>
  5. <version>5.15.11</version>
  6. </dependency>
  7. <dependency>
  8. <groupId>org.apache.activemq</groupId>
  9. <artifactId>activemq-pool</artifactId>
  10. <version>5.15.10</version>
  11. </dependency>
  12. <dependency>
  13. <groupId>org.apache.xbean</groupId>
  14. <artifactId>xbean-spring</artifactId>
  15. <version>4.15</version>
  16. </dependency>
  17. <dependency>
  18. <groupId>com.fasterxml.jackson.core</groupId>
  19. <artifactId>jackson-databind</artifactId>
  20. <version>2.10.1</version>
  21. </dependency>
  22. <!-- https://mvnrepository.com/artifact/org.springframework/spring-jms -->
  23. <dependency>
  24. <groupId>org.springframework</groupId>
  25. <artifactId>spring-jms</artifactId>
  26. <version>5.2.1.RELEASE</version>
  27. </dependency>
  28. <!-- https://mvnrepository.com/artifact/org.springframework/spring-aop -->
  29. <dependency>
  30. <groupId>org.springframework</groupId>
  31. <artifactId>spring-aop</artifactId>
  32. <version>5.2.1.RELEASE</version>
  33. </dependency>
  34. </dependencies>

2、Spring配置文件(applicationContext.xml)


  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
  6. <!-- 开启包的自动扫描 -->
  7. <context:component-scan base-package="com.demo.activemq"/>
  8. <!-- 配置生产者 -->
  9. <bean id="connectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop">
  10. <property name="connectionFactory">
  11. <!-- 正真可以生产Connection的ConnectionFactory,由对应的JMS服务商提供 -->
  12. <bean class="org.apache.activemq.spring.ActiveMQConnectionFactory">
  13. <property name="brokerURL" value="tcp://192.168.10.130:61616"/>
  14. </bean>
  15. </property>
  16. <property name="maxConnections" value="100"/>
  17. </bean>
  18. <!-- 这个是队列目的地,点对点的Queue -->
  19. <bean id="destinationQueue" class="org.apache.activemq.command.ActiveMQQueue">
  20. <!-- 通过构造注入Queue名 -->
  21. <constructor-arg index="0" value="spring-active-queue"/>
  22. </bean>
  23. <!-- 这个是队列目的地, 发布订阅的主题Topic-->
  24. <bean id="destinationTopic" class="org.apache.activemq.command.ActiveMQTopic">
  25. <constructor-arg index="0" value="spring-active-topic"/>
  26. </bean>
  27. <!-- Spring提供的JMS工具类,他可以进行消息发送,接收等 -->
  28. <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
  29. <!-- 传入连接工厂 -->
  30. <property name="connectionFactory" ref="connectionFactory"/>
  31. <!-- 传入目的地 -->
  32. <property name="defaultDestination" ref="destinationQueue"/>
  33. <!-- 消息自动转换器 -->
  34. <property name="messageConverter">
  35. <bean class="org.springframework.jms.support.converter.SimpleMessageConverter"/>
  36. </property>
  37. </bean>
  38. </beans>

3、编写代码

(1)队列(Queue)

  1. @Service
  2. public class SpringMQ_Producer {
  3. private JmsTemplate jmsTemplate;
  4. @Autowired
  5. public void setJmsTemplate(JmsTemplate jmsTemplate) {
  6. this.jmsTemplate = jmsTemplate;
  7. }
  8. public static void main(String[] args) {
  9. ApplicationContext applicationContext = new ClassPathXmlApplicationContext("Application.xml");
  10. SpringMQ_Producer springMQ_producer = applicationContext.getBean(SpringMQ_Producer.class);
  11. springMQ_producer.jmsTemplate.send(session -> session.createTextMessage("***Spring和ActiveMQ的整合case111....."));
  12. System.out.println("********send task over");
  13. }
  14. }

  1. @Service
  2. public class SpringMQ_Consumer {
  3. private JmsTemplate jmsTemplate;
  4. @Autowired
  5. public void setJmsTemplate(JmsTemplate jmsTemplate) {
  6. this.jmsTemplate = jmsTemplate;
  7. }
  8. public static void main(String[] args) {
  9. ApplicationContext applicationContext = new ClassPathXmlApplicationContext("Application.xml");
  10. SpringMQ_Consumer springMQ_consumer = applicationContext.getBean(SpringMQ_Consumer.class);
  11. String returnValue = (String) springMQ_consumer.jmsTemplate.receiveAndConvert();
  12. System.out.println("****消费者收到的消息: " + returnValue);
  13. }
  14. }

(2)主题(Topic)

生产者和消费者都可以通过jmsTemplate对象实时设置目的地等其他信息

  1. @Service
  2. public class SpringMQ_Topic_Producer {
  3. private JmsTemplate jmsTemplate;
  4. public SpringMQ_Topic_Producer(JmsTemplate jmsTemplate) {
  5. this.jmsTemplate = jmsTemplate;
  6. }
  7. public static void main(String[] args) {
  8. ApplicationContext applicationContext = new ClassPathXmlApplicationContext("Application.xml");
  9. SpringMQ_Topic_Producer springMQ_topic_producer = applicationContext.getBean(SpringMQ_Topic_Producer.class);
  10. //直接调用application.xml里面创建的destinationTopic这个bean设置为目的地就行了
  11. springMQ_topic_producer.jmsTemplate.setDefaultDestination(((Destination) applicationContext.getBean("destinationTopic")));
  12. springMQ_topic_producer.jmsTemplate.send(session -> session.createTextMessage("***Spring和ActiveMQ的整合TopicCase111....."));
  13. }
  14. }

  1. @Service
  2. public class SpringMQ_Topic_Consumer {
  3. private JmsTemplate jmsTemplate;
  4. public SpringMQ_Topic_Consumer(JmsTemplate jmsTemplate) {
  5. this.jmsTemplate = jmsTemplate;
  6. }
  7. public static void main(String[] args) {
  8. ApplicationContext applicationContext = new ClassPathXmlApplicationContext("Application.xml");
  9. SpringMQ_Topic_Consumer springMQConsumer = applicationContext.getBean(SpringMQ_Topic_Consumer.class);
  10. //直接调用application.xml里面创建的destinationTopic这个bean设置为目的地就行了
  11. springMQConsumer.jmsTemplate.setDefaultDestination(((Destination) applicationContext.getBean("destinationTopic")));
  12. String returnValue = (String) springMQConsumer.jmsTemplate.receiveAndConvert();
  13. System.out.println("****消费者收到的消息: " + returnValue);
  14. }
  15. }

4、监听配置

  1. Spring里面实现消费者不启动,直接通过配置监听完成

(1)说明

  1. 类似于前面setMessageListenner实时间提供消息

(2)Spring 配置文件

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
  6. <!-- 开启包的自动扫描 -->
  7. <context:component-scan base-package="com.demo.activemq"/>
  8. <!-- 配置生产者 -->
  9. <bean id="connectionFactory" class="org.apache.activemq.pool.PooledConnectionFactory" destroy-method="stop">
  10. <property name="connectionFactory">
  11. <!-- 正真可以生产Connection的ConnectionFactory,由对应的JMS服务商提供 -->
  12. <bean class="org.apache.activemq.spring.ActiveMQConnectionFactory">
  13. <property name="brokerURL" value="tcp://192.168.10.130:61616"/>
  14. </bean>
  15. </property>
  16. <property name="maxConnections" value="100"/>
  17. </bean>
  18. <!-- 这个是队列目的地,点对点的Queue -->
  19. <bean id="destinationQueue" class="org.apache.activemq.command.ActiveMQQueue">
  20. <!-- 通过构造注入Queue名 -->
  21. <constructor-arg index="0" value="spring-active-queue"/>
  22. </bean>
  23. <!-- 这个是队列目的地, 发布订阅的主题Topic-->
  24. <bean id="destinationTopic" class="org.apache.activemq.command.ActiveMQTopic">
  25. <constructor-arg index="0" value="spring-active-topic"/>
  26. </bean>
  27. <!-- Spring提供的JMS工具类,他可以进行消息发送,接收等 -->
  28. <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
  29. <!-- 传入连接工厂 -->
  30. <property name="connectionFactory" ref="connectionFactory"/>
  31. <!-- 传入目的地 -->
  32. <property name="defaultDestination" ref="destinationQueue"/>
  33. <!-- 消息自动转换器 -->
  34. <property name="messageConverter">
  35. <bean class="org.springframework.jms.support.converter.SimpleMessageConverter"/>
  36. </property>
  37. </bean>
  38. <!-- 配置Jms消息监听器 -->
  39. <bean id="defaultMessageListenerContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
  40. <!-- Jms连接的工厂 -->
  41. <property name="connectionFactory" ref="connectionFactory"/>
  42. <!-- 设置默认的监听目的地 -->
  43. <property name="destination" ref="destinationTopic"/>
  44. <!-- 指定自己实现了MessageListener的类 -->
  45. <property name="messageListener" ref="myMessageListener"/>
  46. </bean>
  47. </beans>

(3)需要写一个类来实现消息监听

  1. /**
  2. * 实现MessageListener的类,需要把这个类交给xml配置里面的DefaultMessageListenerContainer管理
  3. */
  4. @Component
  5. public class MyMessageListener implements MessageListener {
  6. @Override
  7. public void onMessage(Message message) {
  8. if (message instanceof TextMessage) {
  9. TextMessage textMessage = (TextMessage) message;
  10. try {
  11. System.out.println("消费者收到的消息" + textMessage.getText());
  12. } catch (JMSException e) {
  13. e.printStackTrace();
  14. }
  15. }
  16. }
  17. }

(4)消费者配置了自动监听,就相当于在spring里面后台运行,有消息就运行我们实现监听类里面的方法

二、SpringBoot 整合Activemq

1、队列(Queue)

1.1 队列生产者:

(1)新建Maven工程并设置包名类名

  1. 工程名: boot_mq_producer
  2. 包名: com.atguigu.boot.activemq

(2)POM依赖文件配置:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5. <modelVersion>4.0.0</modelVersion>
  6. <groupId>com.demo</groupId>
  7. <artifactId>04activemq_springboot-queue</artifactId>
  8. <version>1.0-SNAPSHOT</version>
  9. <!-- <parent>-->
  10. <!-- <groupId>org.springframework.boot</groupId>-->
  11. <!-- <artifactId>spring-boot-starter-parent</artifactId>-->
  12. <!-- <version>2.2.1.RELEASE</version>-->
  13. <!-- </parent>-->
  14. <dependencies>
  15. <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter -->
  16. <dependency>
  17. <groupId>org.springframework.boot</groupId>
  18. <artifactId>spring-boot-starter</artifactId>
  19. <version>2.2.1.RELEASE</version>
  20. </dependency>
  21. <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter -->
  22. <dependency>
  23. <groupId>org.springframework.boot</groupId>
  24. <artifactId>spring-boot-starter-activemq</artifactId>
  25. <version>2.2.1.RELEASE</version>
  26. </dependency>
  27. <dependency>
  28. <groupId>org.springframework.boot</groupId>
  29. <artifactId>spring-boot-starter-web</artifactId>
  30. <version>2.2.1.RELEASE</version>
  31. </dependency>
  32. <dependency>
  33. <groupId>org.springframework.boot</groupId>
  34. <artifactId>spring-boot-starter-test</artifactId>
  35. <version>2.2.1.RELEASE</version>
  36. </dependency>
  37. </dependencies>
  38. </project>

(3)application.yml 文件

  1. #Springboot启动端口
  2. server:
  3. port: 8080
  4. #ActiveMQ配置
  5. spring:
  6. activemq:
  7. broker-url: tcp://192.168.10.130:61616 #ActiveMQ服务器IP
  8. user: admin #ActiveMQ连接用户名
  9. password: admin #ActiveMQ连接密码
  10. jms:
  11. #指定连接队列还是主题
  12. pub-sub-domain: false # false = Queue | true = Topic
  13. #定义服务上的队列名
  14. myQueueName: springboot-activemq-queue

(4)配置队列bean

类似于Spring的ApplicationContext.xml文件

  1. @Component
  2. @EnableJms //开启Springboot的Jms
  3. public class ConfigBean {
  4. @Value("myQueueName")
  5. private String myQueueName;
  6. @Bean
  7. public ActiveMQQueue queue() {
  8. //创建一个ActiveMQQueue
  9. return new ActiveMQQueue(myQueueName);
  10. }
  11. }

(5)队列生产者

  1. @Component
  2. public class Queue_Producer {
  3. //JmsMessagingTemplate是Springboot的Jms模板,Spring的是JmsTemplate
  4. private JmsMessagingTemplate jmsMessagingTemplate;
  5. //把ConfigBean类的ActiveMQQueue注入进来
  6. private ActiveMQQueue activeMQQueue;
  7. //发送Queue的方法
  8. public void producerMsg() {
  9. jmsMessagingTemplate.convertAndSend(activeMQQueue, "**************" + UUID.randomUUID().toString());
  10. }
  11. //构造注入对象(推荐)
  12. public Queue_Producer(JmsMessagingTemplate jmsMessagingTemplate, ActiveMQQueue activeMQQueue) {
  13. this.jmsMessagingTemplate = jmsMessagingTemplate;
  14. this.activeMQQueue = activeMQQueue;
  15. }
  16. }

(6)测试单元

  1. @SpringBootTest(classes = MainApp.class)
  2. @RunWith(SpringJUnit4ClassRunner.class)
  3. @WebAppConfiguration
  4. public class TestActiveMQ {
  5. @Autowired
  6. private Queue_Producer queue_producer;
  7. @Test
  8. public void testSend() {
  9. queue_producer.producerMsg();
  10. }
  11. }

结果: 测试结果应该是消息正常生产,并在控制台能够看到入列数大于0且为消费消息大于0

1.2  队列消费者

(1)1.新建Mavaen工程并设置包名类名

(2)Pom依赖配置与生产者一致

(3)application.yml

  1. server:
  2. port: 8081

这里仅对端口进行修改,其他配置与生产者一致

(4)消息消费者

  1. @Component
  2. public class Queue_consummer {
  3. @JmsListener(destination = "${myqueue}") // 注解监听
  4. public void receive(TextMessage textMessage) throws Exception{
  5. System.out.println(" *** 消费者收到消息 ***"+textMessage.getText());
  6. }
  7. }

1.3  定时投递与监听消费

  1. 新需求: 要求每隔3秒钟,往MQ推送消息 以下定时发送Case,案例修改

分析: 在需要定时推送消息的情况下,同时也需要对消息进行跟踪消费,也就是监听消息的生产并进行消费。

生产者代码:

(1)修改Queue_Produce新增定时投递方法

  1. @Component
  2. public class Queue_Producer {
  3. //间隔3秒投递,SpringBoot的Scheduled用来定时执行
  4. @Scheduled(fixedDelay = 3000)
  5. public void producerMsgScheduled() {
  6. jmsMessagingTemplate.convertAndSend(activeMQQueue, "**************Scheduled" + UUID.randomUUID().toString());
  7. System.out.println("Scheduled定时投递");
  8. }

(2)修改主启动类的MainApp_Producer

  1. @SpringBootApplication
  2. @EnableScheduling
  3. public class MainApp {
  4. public static void main(String[] args) {
  5. SpringApplication.run(MainApp.class);
  6. }
  7. }

在主启动类这里主要是要添加@EnableScheduling 注解,用来开启定时配置

消息消费者代码增强

(1)springboot的消息监听注解

  1. @JmsListener

说明:监听过后会随着springboot一起启动,有消息就执行加了该注解的方法

(2)具体实现代码:

  1. //监听接收的方法
  2. @JmsListener(destination = "${myQueueName}")
  3. public void consumerMsg(TextMessage textMessage) throws JMSException {
  4. String text = textMessage.getText();
  5. System.out.println("***消费者收到的消息: " + text);
  6. }

(3)主启动类

  1. @SpringBootApplication
  2. @EnableScheduling // 开启消息定投功能
  3. public class MainApp_Produce {
  4. public static void main(String[] args) {
  5. SpringApplication.run(MainApp_Produce.class, args);
  6. }
  7. }

2、主题发布订阅(Topic)

2.1 Topic 生产者

(1)新建Maven工程并设置包名类名

(2)POM文件

订阅(Topic)的依赖于队列(Queue)的一致

(3)Yml文件

  1. jms:
  2. pub-sub-domain: true
  3. myTopicName: springboot-activemq-topic

(4)配置bean

  1. @Component
  2. @EnableJms //开启Springboot的Jms
  3. public class ActiveMQConfigBean {
  4. @Value("${myTopicName}")
  5. private String topicName;
  6. @Bean
  7. public ActiveMQTopic activeMQTopic() {
  8. return new ActiveMQTopic(topicName);
  9. }
  10. }

注意:类似于Spring的ApplicationContext.xml文件

(5)Topic生产者代码:

  1. @Component
  2. @EnableScheduling
  3. public class Topic_Producer {
  4. private JmsMessagingTemplate jmsMessagingTemplate;
  5. private ActiveMQTopic activeMQTopic;
  6. @Scheduled(fixedDelay = 3000)
  7. public void producer() {
  8. jmsMessagingTemplate.convertAndSend(activeMQTopic, "主题消息: " + UUID.randomUUID().toString());
  9. }

2.2 Topic 消费者

(1)新建Maven工程并设置包名类名

(2)Pom (同上)

(3)yml文件

  1. jms:
  2. pub-sub-domain: true
  3. myTopicName: springboot-activemq-topic

(4)配置bean

  1. /**
  2. * 设置持久化订阅
  3. * 配置文件的方式无法进行配置持久化订阅。所以需要自己去生成一个持久化订阅
  4. */
  5. @Component
  6. @EnableJms
  7. public class ActiveMQConfigBean {
  8. @Value("${spring.activemq.broker-url}")
  9. private String brokerUrl;
  10. @Value("${spring.activemq.user}")
  11. private String user;
  12. @Value("${spring.activemq.password}")
  13. private String password;
  14. public ConnectionFactory connectionFactory(){
  15. ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory();
  16. connectionFactory.setBrokerURL(brokerUrl);
  17. connectionFactory.setUserName(user);
  18. connectionFactory.setPassword(password);
  19. return connectionFactory;
  20. }
  21. @Bean(name = "jmsListenerContainerFactory")
  22. public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() {
  23. DefaultJmsListenerContainerFactory defaultJmsListenerContainerFactory = new DefaultJmsListenerContainerFactory();
  24. defaultJmsListenerContainerFactory.setConnectionFactory(connectionFactory());
  25. defaultJmsListenerContainerFactory.setSubscriptionDurable(true);
  26. defaultJmsListenerContainerFactory.setClientId("我是持久订阅者一号");
  27. return defaultJmsListenerContainerFactory;
  28. }

配置文件的方式无法进行配置持久化订阅。所以需要自己去生成一个持久化订阅

(5)Topic消费者代码

  1. @Component
  2. public class Topic_Consumer {
  3. //需要在监听方法指定连接工厂
  4. @JmsListener(destination = "${myTopicName}",containerFactory = "jmsListenerContainerFactory")
  5. public void consumer(TextMessage textMessage) throws JMSException {
  6. System.out.println("订阅着收到消息: " + textMessage.getText());
  7. }
  8. }

重点:

  1. @JmsListener(destination = "${myTopicName}",containerFactory = "jmsListenerContainerFactory")

启动顺序:先启动消费者,后启动生产者

ActiveMQ 笔记(四)Spring\SpringBoot 整合 Activemq的更多相关文章

  1. SpringBoot整合ActiveMQ和开启持久化

    一.点对点 1.提供者目录展示 2.导入依赖 <dependency> <groupId>org.springframework.boot</groupId> &l ...

  2. ActiveMQ与Spring / SpringBoot 整合(四)

    1. 对 Spring 的整合 1.1 所需jar 包 <!-- activeMQ jms 的支持 --> <dependency> <groupId>org.sp ...

  3. SpringBoot系列八:SpringBoot整合消息服务(SpringBoot 整合 ActiveMQ、SpringBoot 整合 RabbitMQ、SpringBoot 整合 Kafka)

    声明:本文来源于MLDN培训视频的课堂笔记,写在这里只是为了方便查阅. 1.概念:SpringBoot 整合消息服务 2.具体内容 对于异步消息组件在实际的应用之中会有两类: · JMS:代表作就是 ...

  4. Web项目容器集成ActiveMQ & SpringBoot整合ActiveMQ

    集成tomcat就是随项目启动而启动tomcat,最简单的方法就是监听器监听容器创建之后以Broker的方式启动ActiveMQ. 1.web项目中Broker启动的方式进行集成 在这里采用Liste ...

  5. SpringBoot整合ActiveMQ快速入门

    Spring Boot 具有如下特性: 为基于 Spring 的开发提供更快的入门体验 开箱即用,没有代码生成,也无需 XML 配置.同时也可以修改默认值来满足特定的需求. 提供了一些大型项目中常见的 ...

  6. 解决Springboot整合ActiveMQ发送和接收topic消息的问题

    环境搭建 1.创建maven项目(jar) 2.pom.xml添加依赖 <parent> <groupId>org.springframework.boot</group ...

  7. spring boot整合activemq消息中间件

    spring boot整合activemq消息中间件 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi ...

  8. activeMQ入门+spring boot整合activeMQ

    最近想要学习MOM(消息中间件:Message Oriented Middleware),就从比较基础的activeMQ学起,rabbitMQ.zeroMQ.rocketMQ.Kafka等后续再去学习 ...

  9. Spring Boot 项目学习 (四) Spring Boot整合Swagger2自动生成API文档

    0 引言 在做服务端开发的时候,难免会涉及到API 接口文档的编写,可以经历过手写API 文档的过程,就会发现,一个自动生成API文档可以提高多少的效率. 以下列举几个手写API 文档的痛点: 文档需 ...

随机推荐

  1. word 小技巧 方框中 打 对勾

    方框中  打 对勾 称为 复选框 控件,单击鼠标,在两种符号中切换. 设置步骤 1. 将隐藏的"开发工具"选项卡,显示出来 2. 在所需位置,插入复选框 3. 在属性中,设置复选框 ...

  2. # C#学习笔记(一)——准备工作

    C#学习笔记(一)--准备工作 目录 C#学习笔记(一)--准备工作 1.1 下载安装.NET框架 1.2 创建源代码 1.3 一些基本名称 1.4 简单的命名建议 1.1 下载安装.NET框架 .N ...

  3. 【matlab 基础篇 02】基础知识一键扫盲,看完即可无障碍编程(超详细+图文并茂)

    博主快速入门matlab,系统地整理一遍,如何你和我一样是一个新手,那么此文很适合你: 本人能力有限,文中难免有错误和纰漏之处,请大佬们不吝赐教 创作不易,如果本文帮到了您: 请帮忙点个赞

  4. ArrayList扩容机制实探

    ArrayList初始化 问题:执行以下代码后,这个list的列表大小(size)和容量(capacity)分别是多大? List<String> list = new ArrayList ...

  5. Algorithms - Quicksort - 快速排序算法

    相关概念 快速排序法 Quicksort 也是一个分治思想的算法. 对一个子数组 A[p: r] 进行快速排序的三步分治过程: 1, 分解. 将数组 A[p : r] 被划分为两个子数组(可能为空) ...

  6. 学习python的第一天,python的简单知识

    python 是现如今比较火的一种编程语言.在抱着试试的态度我来进行学习下python.要学习python 要先进行环境的安装. 下面是下载链接:https://pan.baidu.com/s/1PW ...

  7. Hive环境搭建和SparkSql整合

    一.搭建准备环境 在搭建Hive和SparkSql进行整合之前,首先需要搭建完成HDFS和Spark相关环境 这里使用Hive和Spark进行整合的目的主要是: 1.使用Hive对SparkSql中产 ...

  8. Redis系列(七)Redis面试题

    Redis 系列: Redis系列(一)Redis入门 Redis系列(二)Redis的8种数据类型 Redis系列(三)Redis的事务和Spring Boot整合 Redis系列(四)Redis配 ...

  9. .Net Core3.0 WebApi 项目框架搭建 一:实现简单的Resful Api

    .Net Core3.0 WebApi 项目框架搭建:目录 开发环境 Visual Studio 2019.net core 3.1 创建项目 新建.net core web项目,如果没有安装.net ...

  10. VST的安装

    对需要使用VST的用户,你可以到http://www.soft-gems.net/去免费下载没有使用限制.没有广告的VST.包括例子程序以及说明文档也可以下载到,下载完成后,就是安装,以前版本的VST ...