你还还还没学会RabbitMQ?-----------RabbitMQ详解及快速入门(工作模式)

news2025/2/27 5:56:40

你像天外来物一样,求之不得(咳咳,指offer)🌹

文章目录

    • 什么是MQ?
    • MQ的优势与劣势
    • 使用MQ需要满足的条件
    • 常见的MQ产品
    • 关于RabbitMQ
    • 生产者
    • 消费者
    • 工作模式
    • 订阅模式
    • 路由模式
    • 通配符模式

什么是MQ?

Message Queue 消息队列,是在消息的传输过程中保存消息的容器,多用于分布式系统之间通信。
在这里插入图片描述

MQ的优势与劣势

优势:
应用解耦:比如一个订单系统需要和库存系统、支付系统等配合起来才能完成支付操作,如果库存系统挂了,那么订单系统也不能正常工作了;但是引入MQ之后,即使库存系统发生故障,只需要将订单系统要求库存系统执行的操作保存到MQ中就可以了,不会影响到订单系统。

异步提速:如果两个系统直接耦合,那么所执行的操作都是同步的,如果涉及到多个系统,那么同步就会耗费较多的时间,加入MQ之后,可以实现消息的异步发送,达到一个提速的作用,给客户一个较好的体验。

削峰填谷:在用户请求量很大的情况下,一个系统所容纳的请求量又是有限的,在这种情况下,可以引入MQ,MQ的作用就是承载用户请求,起到一个缓冲的作用。

劣势:
系统可用性降低:系统引入的外部依赖越多,系统的稳定性就越差。引入MQ之后需要保证MQ的高可用。

系统复杂度提高:需要保证消息传递的顺序性以及消息不会被重复消费。

一致性问题:通过MQ给多个系统发送消息,有的系统处理数据成功,而有的处理数据失败,如何保证数据的一致性问题。

使用MQ需要满足的条件

生产者不需要从消费者获得反馈; 容许短暂的不一致; 解耦、提速等方面的收益要超过加入、管理MQ的成本

常见的MQ产品

在这里插入图片描述

关于RabbitMQ

基础架构:
在这里插入图片描述

六种工作模式:简单模式、workqueues、发布订阅模式、路由模式、主题模式、远程调用模式

生产者

package com.thorn.producer;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer_HelloWorld {
    public static void main(String[] args) throws IOException, TimeoutException {
//        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
//        创建队列
        channel.queueDeclare("hello_world",true,false,false,null);


        String body = "hello rabbitmq";
//        发送消息
        channel.basicPublish("","hello_world",null,body.getBytes());
//          释放资源
        channel.close();
        connection.close();

    }
}

运行上述程序之后,就能看到消息队列了。
在这里插入图片描述

消费者

package com.thorn.consumer;

import com.rabbitmq.client.*;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Consumer_HelloWorld {
    public static void main(String[] args) throws IOException, TimeoutException {
        //        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
//        创建队列
        channel.queueDeclare("hello_world",true,false,false,null);

//        接收消息
        Consumer consumer = new DefaultConsumer(channel){
//            回调方法,当收到消息后,会自动执行该方法
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                System.out.println(consumerTag  );
                System.out.println(envelope.getRoutingKey());
                System.out.println(envelope.getExchange());
                System.out.println(properties);
                System.out.println(new String(body));
            }
        };
        channel.basicConsume("hello_world",true,consumer);

    }
}

执行结果,拿到消息队列中的消息了。
在这里插入图片描述
这是简单模式下的。

工作模式

工作队列模式:
在这里插入图片描述
多个消费者共同监听一个生产者,主要适用于任务较多的情况。
生产者(一口气生产十条消息):

package com.thorn.producer;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer_WorkQueues {
    public static void main(String[] args) throws IOException, TimeoutException {
//        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
//        创建队列
        channel.queueDeclare("work_queues",true,false,false,null);
        for (int i = 0; i < 10; i++) {
            String body = i + "  hello work_queues~~~";
//        发送消息
            channel.basicPublish("","work_queues",null,body.getBytes());
        }


//          释放资源
        channel.close();
        connection.close();

    }
}

消费者(需要创建两个):

package com.thorn.consumer;

import com.rabbitmq.client.*;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Consumer_WorkQueues1 {
    public static void main(String[] args) throws IOException, TimeoutException {
        //        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
//        创建队列
        channel.queueDeclare("work_queues",true,false,false,null);

//        接收消息
        Consumer consumer = new DefaultConsumer(channel){
//            回调方法,当收到消息后,会自动执行该方法
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {

                System.out.println("body:"+new String(body));
            }
        };
        channel.basicConsume("work_queues",true,consumer);

    }
}

第一个消费者:
在这里插入图片描述
第二个消费者:
在这里插入图片描述
可以看到,一共生产了十条消息,每个消费者消费五条消息。

订阅模式

引入了交换机,交换机去创建两个队列。
在这里插入图片描述
生产者:

package com.thorn.producer;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer_Pubhub {
    public static void main(String[] args) throws IOException, TimeoutException {
//        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
//          创建交换机
        String exchangeName = "test_fanout";
        channel.exchangeDeclare(exchangeName, BuiltinExchangeType.FANOUT,true,false,false,null);

//        创建队列
        String queue1Name = "test_fanout_queue1";
        String queue2Name = "test_fanout_queue2";
        channel.queueDeclare(queue1Name,true,false,false,null);
        channel.queueDeclare(queue2Name,true,false,false,null);

//        绑定队列和交换机
        channel.queueBind(queue1Name,exchangeName,"");
        channel.queueBind(queue2Name,exchangeName,"");

//        发送消息
        String body = "日志信息:张三调用方法findAll,日志级别为info";
        channel.basicPublish(exchangeName,"",null,body.getBytes());
//        释放资源
        channel.close();
        connection.close();

    }
}

消费者:

package com.thorn.consumer;

import com.rabbitmq.client.*;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Consumer_PubSub1 {
    public static void main(String[] args) throws IOException, TimeoutException {
        //        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
        String queue1Name = "test_fanout_queue1";
        String queue2Name = "test_fanout_queue2";
//        接收消息
        Consumer consumer = new DefaultConsumer(channel){
//            回调方法,当收到消息后,会自动执行该方法
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                System.out.println("将日志信息打印到控制台:");
                System.out.println("body:"+new String(body));

            }
        };
        channel.basicConsume(queue1Name,true,consumer);

    }
}

在这里插入图片描述

package com.thorn.consumer;

import com.rabbitmq.client.*;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Consumer_PubSub2 {
    public static void main(String[] args) throws IOException, TimeoutException {
        //        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
        String queue1Name = "test_fanout_queue1";
        String queue2Name = "test_fanout_queue2";
//        接收消息
        Consumer consumer = new DefaultConsumer(channel){
//            回调方法,当收到消息后,会自动执行该方法
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                System.out.println("将日志信息保存到数据库:");
                System.out.println("body:"+new String(body));

            }
        };
        channel.basicConsume(queue2Name,true,consumer);

    }
}

在这里插入图片描述

路由模式

在这里插入图片描述
生产者:

package com.thorn.producer;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer_Routing {
    public static void main(String[] args) throws IOException, TimeoutException {
//        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
//          创建交换机
        String exchangeName = "test_direct";
        channel.exchangeDeclare(exchangeName, BuiltinExchangeType.DIRECT,true,false,false,null);

//        创建队列
        String queue1Name = "test_direct_queue1";
        String queue2Name = "test_direct_queue2";
        channel.queueDeclare(queue1Name,true,false,false,null);
        channel.queueDeclare(queue2Name,true,false,false,null);

//        绑定队列和交换机
//        队列1绑定
        channel.queueBind(queue1Name,exchangeName,"error");
//        队列2绑定
        channel.queueBind(queue2Name,exchangeName,"info");
        channel.queueBind(queue2Name,exchangeName,"error");
        channel.queueBind(queue2Name,exchangeName,"warning");

//        发送消息
        String body = "日志信息:张三调用方法findAll,日志级别为info";
        channel.basicPublish(exchangeName,"info",null,body.getBytes());
//        释放资源
        channel.close();
        connection.close();

    }
}

将error级别的信息放到队列1,将error、info、warning级别的信息放到队列2.

消费者1:

package com.thorn.consumer;

import com.rabbitmq.client.*;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Consumer_Routing1 {
    public static void main(String[] args) throws IOException, TimeoutException {
        //        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
        String queue2Name = "test_direct_queue2";

//        接收消息
        Consumer consumer = new DefaultConsumer(channel){
//            回调方法,当收到消息后,会自动执行该方法
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                System.out.println("将日志信息打印到控制台:");
                System.out.println("body:"+new String(body));

            }
        };
        channel.basicConsume(queue2Name,true,consumer);

    }
}

消费者2:

package com.thorn.consumer;

import com.rabbitmq.client.*;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Consumer_Routing2 {
    public static void main(String[] args) throws IOException, TimeoutException {
        //        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
        String queue1Name = "test_direct_queue1";

//        接收消息
        Consumer consumer = new DefaultConsumer(channel){
//            回调方法,当收到消息后,会自动执行该方法
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                System.out.println("将日志信息保存到数据库:");
                System.out.println("body:"+new String(body));

            }
        };
        channel.basicConsume(queue1Name,true,consumer);

    }
}

可以看到消费者1可以收到消息,而消费者2收不到消息
在这里插入图片描述
在这里插入图片描述

通配符模式

在这里插入图片描述
生产者:

package com.thorn.producer;

import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Producer_Topics {
    public static void main(String[] args) throws IOException, TimeoutException {
//        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();
//          创建交换机
        String exchangeName = "test_topic";
        channel.exchangeDeclare(exchangeName, BuiltinExchangeType.TOPIC,true,false,false,null);

//        创建队列
        String queue1Name = "test_topic_queue1";
        String queue2Name = "test_topic_queue2";
        channel.queueDeclare(queue1Name,true,false,false,null);
        channel.queueDeclare(queue2Name,true,false,false,null);

//        绑定队列和交换机
        channel.queueBind(queue1Name,exchangeName,"#.error");
        channel.queueBind(queue1Name,exchangeName,"order.*");
//        队列2打印所有信息
        channel.queueBind(queue2Name,exchangeName,"*.*");

//        发送消息
        String body = "日志信息:张三调用方法findAll,日志级别为info";
        channel.basicPublish(exchangeName,"order.info",null,body.getBytes());
//        释放资源
        channel.close();
        connection.close();

    }
}

消费者1:

package com.thorn.consumer;

import com.rabbitmq.client.*;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Consumer_Topics1 {
    public static void main(String[] args) throws IOException, TimeoutException {
        //        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();

        String queue1Name = "test_topic_queue1";
        String queue2Name = "test_topic_queue2";

//        接收消息
        Consumer consumer = new DefaultConsumer(channel){
//            回调方法,当收到消息后,会自动执行该方法
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                System.out.println("将日志信息存入到数据库");
                System.out.println("body:"+new String(body));

            }
        };
        channel.basicConsume(queue1Name,true,consumer);

    }
}

消费者2:

package com.thorn.consumer;

import com.rabbitmq.client.*;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class Consumer_Topics2 {
    public static void main(String[] args) throws IOException, TimeoutException {
        //        创建连接工厂
        ConnectionFactory factory = new ConnectionFactory();
//    设置参数
        factory.setVirtualHost("/thorns");
        factory.setUsername("lwj");
        factory.setPassword("lwj");
//        创建链接
        Connection connection = factory.newConnection();
//        创建channel
        Channel channel = connection.createChannel();

        String queue1Name = "test_topic_queue1";
        String queue2Name = "test_topic_queue2";

//        接收消息
        Consumer consumer = new DefaultConsumer(channel){
//            回调方法,当收到消息后,会自动执行该方法
            @Override
            public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
                System.out.println("将日志信息打印到控制台");
                System.out.println("body:"+new String(body));

            }
        };
        channel.basicConsume(queue2Name,true,consumer);

    }
}

消费者1和消费者2都能收到消息:
在这里插入图片描述
在这里插入图片描述
恭喜你又学会了一项技术!
在这里插入图片描述
如果觉得有帮助的小伙伴点个赞吧~感谢收看!

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

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

相关文章

机器学习——支持向量机的训练

目录 实践SVM分类 测试1-1​编辑 测试1-2 SVM核心 支持向量机函数 分类器SVC的主要属性: 分类器SVC的主要方法: 回归器SVR的主要属性: 支持向量机在鸢尾花分类中的应用 实践SVM分类 (1)参数C的选择: C为惩罚系数,也称为正则化系数: C越小模型越受限&#xff08;即单个数据…

【设计模式】从Mybatis源码中学习到的10种设计模式

文章目录一、前言二、源码&#xff1a;学设计模式三、类型&#xff1a;创建型模式1. 工厂模式2. 单例模式3. 建造者模式四、类型&#xff1a;结构型模式1. 适配器模式2. 代理模式3. 组合模式4. 装饰器模式五、类型&#xff1a;行为型模式1. 模板模式2. 策略模式3. 迭代器模式六…

长江流域9省2市可视化(不展示业务信息水质及真实断面)

一、处理9省2市地理信息为geojson集成到项目 shp转geojson关键Java代码 /*** shp转换为Geojson* param shpPath* return*/ public static Map shape2Geojson(String shpPath,String filePath){Map map new HashMap();FeatureJSON fjson new FeatureJSON();try{StringBuffer …

阶段二33_面向对象高级_IO[转换流,对象流]

知识点&#xff1a; 1.转换流&#xff1a;InputStreamReader&#xff0c;OutputStreamWriter2.对象流&#xff1a;ObjectInputStream&#xff0c;ObjectOutputStream一.转换流 1.转换流原理图 2.转换流概述 转换流就是来进行字节流和字符流之间转换的 InputStreamReader是从…

p75 应急响应-数据库漏洞口令检索应急取证箱

数据来源 必须知识点&#xff1a; 第三方应用由于是选择性安装&#xff0c;如何做好信息收集和漏洞探针也是获取攻击者思路的重要操作&#xff0c; 除去本身漏洞外&#xff0c;提前预知或口令相关攻击也要进行筛选。排除三方应用攻击行为&#xff0c;自查漏洞分析攻击者思路&a…

表白墙(服务器版)

文章目录一、准备工作二、前后端交互后端前端三、数据库版本一、准备工作 我们之前实现过这样一个表白墙&#xff0c;具体前端代码参考 表白墙 这篇文章 但是我们之前写的这个表白墙有一些问题&#xff1a; 1.如果我们刷新页面/重新开启&#xff0c;之前的数据就不见了 2.我们…

python pyc文件

参考自 What are pyc files in Python 和Python什么情况下会生成pyc文件&#xff1f; - 知乎 加上了我自己的理解 官方文档有这么解释 A program doesnt run any faster when it is read from a ‘.pyc’ or ‘.pyo’ file than when it is read from a ‘.py’ file; the o…

C生万物 | 一探指针函数与函数指针的奥秘

文章目录一、指针函数1、定义2、示例二、函数指针1、概念理清2、如何调用函数指针&#xff1f;3、两道“有趣”的代码题O(∩_∩)O< 第一题 >< 第二题 >4、函数指针数组概念明细具体应用&#xff1a;转移表✔5、指向函数指针数组的指针三、实战训练 —— 回调函数1、…

Pix4D软件简易使用方法

一、实验目的 学习无人机处理软件 Pix4D 的各项基本功能模块&#xff0c;掌握处理无人机影像的一般处理流程及质量评价。学习新建项目&#xff0c;对图像进行初始化操作以便后处理。学会制作正射影像图&#xff0c;生成质量报告&#xff0c;并对其进行分析。 二、实验内容 &…

抽象轻松MySqL

第一步安装下载MySQL 手把手教你下载安装 第一步打开官方网站 这里提供两种——第一种懒人版&#xff1a;MySQL点击蓝色字会有链接 第二种手动版本&#xff1a;百度搜索Mysql&#xff08;注意不要点.cn的因为有点翻译问题&#xff09; 点开后的图如下 接下来开始装备下载 点…

Disentangled Graph Collaborative Filtering

代码地址&#xff1a;https://github.com/ xiangwang1223/disentangled_graph_collaborative_filtering Background&#xff1a; 现有模型在很大程度上以统一的方式对用户-物品关系进行建模(将模型看做黑盒&#xff0c;历史交互作为输入&#xff0c;Embedding作为输出。)&…

【C++进阶之路】初始C++

文章目录一.C的发展历史时代背景产生原因发型版本二.C的应用场景三.C 的学习成本C的难度C的学习阶段21天精通C的梗一.C的发展历史 时代背景 20世纪60年代——软件危机。部分原因:C语言等计算机语言是面向过程语言&#xff0c;在编写大型程序需要高度抽象与建模&#xff0c;此…

HTML中表格标签<table><tr><tb><th>中单元格的合并问题

前情知晓 层级关系如下&#xff1a; <table><tr><td> </td><th> </th></tr></table> <table>...</table> 用于定义一个表格开始和结束 <tr>...</tr> 定义一行标签&#xff0c;一组行标签内可以建立…

【前端】从零开始读懂Web3

序言 用心生活&#xff0c;用力向上&#xff0c;微笑前行&#xff0c;就是对生活最好的回馈。 本专栏说明&#xff1a; 主要是记录在分享知识的同时&#xff0c;不定时给大家送书的活动。 参与方式&#xff1a; 赠书数量&#xff1a;本次送书 3 本&#xff0c;评论区抽3位小伙伴…

Python进阶特性(类型标注)

1.4 Python进阶特性(类型标注) 1.4.1 类型标注介绍 Python属于动态类型语言&#xff0c;只有在运行代码的时候才能够知道变量类型&#xff0c;那么这样容易产生传入参数类型不一致的问题&#xff0c;导致出现意想不到的bug。这也是动态类型语言天生的一个问题。 所以在Python…

【Spring】— Spring中Bean的装配方式

Spring中Bean的装配方式Bean的装配方式1.基于XML的装配2.基于Annotation的装配3.自动装配Bean的装配方式 Bean的装配可以理解为依赖关系注入&#xff0c;Bean的装配方式即Bean依赖注入的方式。Spring容器支持多种形式的Bean装配方式&#xff0c;如基于XML的装配、基于Annotatio…

电力系统中针对状态估计的虚假数据注入攻击建模与对策(Matlab代码实现)

&#x1f352;&#x1f352;&#x1f352;欢迎关注&#x1f308;&#x1f308;&#x1f308; &#x1f4dd;个人主页&#xff1a;我爱Matlab &#x1f44d;点赞➕评论➕收藏 养成习惯&#xff08;一键三连&#xff09;&#x1f33b;&#x1f33b;&#x1f33b; &#x1f34c;希…

免费部署属于自己的chatGPT网站,欢迎大家试玩

最近我发现了一个非常nice的部署网站的工具&#xff0c; railway&#xff0c;这个网站是国外的&#xff0c;所以部署出来的项目域名是国外的&#xff0c;并不需要担心封号&#xff0c;也不需要进行域名注册&#xff0c;部署成功之后会自动生成域名&#xff0c;在国内就能够正常…

[NSSRound#11] 密码学个人赛

这个比赛没有参加,跟别人要了些数据跑一下,其实交互这东西基本上一样,跑通就行. ez_enc 这题有点骗人,给了一堆AB串,一开始以为是培根密码,结果出来很乱.再看长度:192 应该就是01替换 a ABAABBBAABABAABBABABAABBABAAAABBABABABAAABAAABBAABBBBABBABBABBABABABAABBAABBABAA…

“心机boy”马斯克:明面上呼吁暂停先进AI研发,背地里悄悄买1万块GPU推进大模型项目

来源: AI前线 微信号&#xff1a;ai-front 整理 | 冬梅、核子可乐 为了研发自家 AIGC&#xff0c; 马斯克狂买 GPU 并四处挖人 当地时间 4 月 11 日&#xff0c;据多家外媒报道&#xff0c;尽管高调建议在整个行业范围内停止 AI 训练&#xff0c;但伊隆马斯克本人倒是在 T…