04_SSM整合ActiveMQ支持多种类型消息
生活随笔
收集整理的這篇文章主要介紹了
04_SSM整合ActiveMQ支持多种类型消息
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
接上一篇:企業實戰03_SSM整合ActiveMQ支持多種類型消息https://blog.csdn.net/weixin_40816738/article/details/100572104
1、StreamMessage java原始值數據流
2、MapMessage 鍵值對
3、TextMessage 字符串
4、ObjectMessage 一個序列化的java對象
5、BytesMessage 一個字節的數據流
此文章為企業實戰的展示操作,如果有地方不懂請留言,我看到后,會進行統一回復,讓我們一起進步,為自己加油!!!
| ssm-activemq | 父工程,統一版本控制 |
| producer | 生產者 |
| consumer | 消費者 |
| base-pojo | 公共實體類 |
| base-dao | 公共接口,數據庫連接 |
文章目錄
- 四、base-dao操作
- 4.1. 創建接口UserMapper
- 4.2. 在resources目錄下面操作
- 4.2.1. 創建mybatis文件夾
- 4.2.2. 在mybatis文件夾下,新建db.properties文件
- 4.2.3. 在mybatis文件夾下,新建SqlMapConfig.xml文件
- 4.2.4. 在resources文件夾下,創建spring文件夾
- 4.2.5. 在spring文件夾下,創建applicationContext-dao.xml文件
- 4.2.6. 在spring文件夾下,創建applicationContext-service.xml文件
四、base-dao操作
4.1. 創建接口UserMapper
package com.gblfy.mq.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.gblfy.mq.entity.User;/*** @author gblfy* @ClassNme UserMapper* @Description TODO* @Date 2019/9/4 23:54* @version1.0*/ public interface UserMapper extends BaseMapper<User> { }4.2. 在resources目錄下面操作
4.2.1. 創建mybatis文件夾
4.2.2. 在mybatis文件夾下,新建db.properties文件
#數據庫連接 #適用于mysql 6.x及以上 jdbc.driver=com.mysql.cj.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/lcs?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT jdbc.username=root jdbc.password=root#適用于mysql 5.x #jdbc.driver=com.mysql.jdbc.Driver #jdbc.url=jdbc:mysql://DB Host:DB Port/order?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8 #jdbc.username=DB Username #jdbc.password=DB Password4.2.3. 在mybatis文件夾下,新建SqlMapConfig.xml文件
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration></configuration>4.2.4. 在resources文件夾下,創建spring文件夾
4.2.5. 在spring文件夾下,創建applicationContext-dao.xml文件
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"xmlns:context="http://www.springframework.org/schema/context"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"><!-- 數據庫連接池 --><!-- 加載配置文件 --><context:property-placeholder location="classpath:mybatis/*.properties" /><!-- 數據庫連接池 --><bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"destroy-method="close"><property name="url" value="${jdbc.url}" /><property name="username" value="${jdbc.username}" /><property name="password" value="${jdbc.password}" /><property name="driverClassName" value="${jdbc.driver}" /><property name="maxActive" value="10" /><property name="minIdle" value="5" /></bean><!-- 讓spring管理sqlsessionfactory 使用mybatis和spring整合包中的 --><bean id="sqlSessionFactoryBean" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean"><!-- 數據庫連接池 --><property name="dataSource" ref="dataSource"/><!-- 加載mybatis的全局配置文件 --><property name="configLocation" value="classpath:mybatis/SqlMapConfig.xml" /></bean><!--配置mybatis 掃描mapper接口的路徑--><bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"><property name="basePackage" value="com.gblfy.mq.mapper"/></bean> </beans>4.2.6. 在spring文件夾下,創建applicationContext-service.xml文件
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"xmlns:context="http://www.springframework.org/schema/context"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"><!-- spring自動去掃描base-pack下面或者子包下面的java文件--><!--管理Service實現類--><context:component-scan base-package="com.gblfy.mq"/> </beans>下一篇:企業實戰05_SSM整合ActiveMQ支持多種類型消息https://blog.csdn.net/weixin_40816738/article/details/100572129
本專欄項目下載鏈接:
| GitLab項目 | https://gitlab.com/gb-heima/ssm-activemq |
| Git | git clone git@gitlab.com:gb-heima/ssm-activemq.git |
| zip包 | https://gitlab.com/gb-heima/ssm-activemq/-/archive/master/ssm-activemq-master.zip |
| Fork地址 | https://gitlab.com/gb-heima/ssm-activemq/-/forks/new |
總結
以上是生活随笔為你收集整理的04_SSM整合ActiveMQ支持多种类型消息的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 企业实战03:Oracle数据库_用户和
- 下一篇: git.exe init#timeout