文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

如何在spring boot中使用spring-kafka实现一个接收消息功能

2023-05-31 11:28

关注

本篇文章为大家展示了如何在spring boot中使用spring-kafka实现一个接收消息功能,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

实现方法

pom.xml文件如下

<&#63;xml version="1.0" encoding="UTF-8"&#63;><project xmlns="http://maven.apache.org/POM/4.0.0"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>  <groupId>org.linuxsogood.sync</groupId> <artifactId>linuxsogood-sync</artifactId> <version>1.0.0-SNAPSHOT</version>  <parent>  <groupId>org.springframework.boot</groupId>  <artifactId>spring-boot-starter-parent</artifactId>  <version>1.4.0.RELEASE</version> </parent>  <properties>  <java.version>1.8</java.version>  <!-- 依赖版本 -->  <mybatis.version>3.3.1</mybatis.version>  <mybatis.spring.version>1.2.4</mybatis.spring.version>  <mapper.version>3.3.6</mapper.version>  <pagehelper.version>4.1.1</pagehelper.version> </properties>  <dependencies>  <dependency>   <groupId>org.springframework.boot</groupId>   <artifactId>spring-boot-starter-web</artifactId>  </dependency>  <dependency>   <groupId>org.springframework.boot</groupId>   <artifactId>spring-boot-starter-jdbc</artifactId>  </dependency>  <dependency>   <groupId>org.springframework.boot</groupId>   <artifactId>spring-boot-starter-aop</artifactId>  </dependency>  <dependency>   <groupId>org.springframework.boot</groupId>   <artifactId>spring-boot-starter-freemarker</artifactId>  </dependency>  <!--<dependency>   <groupId>org.springframework.boot</groupId>   <artifactId>spring-boot-starter-integration</artifactId>   <scope>compile</scope>  </dependency>  <dependency>   <groupId>org.springframework.integration</groupId>   <artifactId>spring-integration-kafka</artifactId>   <version>2.0.1.RELEASE</version>   <scope>compile</scope>  </dependency>  <dependency>   <groupId>org.springframework.integration</groupId>   <artifactId>spring-integration-core</artifactId>   <version>4.3.1.RELEASE</version>   <scope>compile</scope>  </dependency>-->  <dependency>   <groupId>org.springframework.kafka</groupId>   <artifactId>spring-kafka</artifactId>   <version>1.1.0.RELEASE</version>  </dependency>  <!--<dependency>   <groupId>org.springframework.kafka</groupId>   <artifactId>spring-kafka-test</artifactId>   <version>1.1.0.RELEASE</version>  </dependency>-->  <dependency>   <groupId>junit</groupId>   <artifactId>junit</artifactId>   <version>4.12</version>   <scope>test</scope>  </dependency>  <dependency>   <groupId>org.assertj</groupId>   <artifactId>assertj-core</artifactId>   <version>3.5.2</version>  </dependency>  <dependency>   <groupId>org.hamcrest</groupId>   <artifactId>hamcrest-all</artifactId>   <version>1.3</version>   <scope>test</scope>  </dependency>  <dependency>   <groupId>org.mockito</groupId>   <artifactId>mockito-all</artifactId>   <version>1.9.5</version>   <scope>test</scope>  </dependency>  <dependency>   <groupId>org.springframework</groupId>   <artifactId>spring-test</artifactId>   <version>4.2.3.RELEASE</version>   <scope>test</scope>  </dependency>  <dependency>   <groupId>org.springframework.boot</groupId>   <artifactId>spring-boot-starter-test</artifactId>   <scope>test</scope>  </dependency>  <dependency>   <groupId>mysql</groupId>   <artifactId>mysql-connector-java</artifactId>  </dependency>  <dependency>   <groupId>com.microsoft.sqlserver</groupId>   <artifactId>sqljdbc4</artifactId>   <version>4.0.0</version>  </dependency>  <dependency>   <groupId>com.alibaba</groupId>   <artifactId>druid</artifactId>   <version>1.0.11</version>  </dependency>   <!--Mybatis-->  <dependency>   <groupId>org.mybatis</groupId>   <artifactId>mybatis</artifactId>   <version>${mybatis.version}</version>  </dependency>  <dependency>   <groupId>org.mybatis</groupId>   <artifactId>mybatis-spring</artifactId>   <version>${mybatis.spring.version}</version>  </dependency>  <!--<dependency>   <groupId>org.mybatis.spring.boot</groupId>   <artifactId>mybatis-spring-boot-starter</artifactId>   <version>1.1.1</version>  </dependency>-->  <!-- Mybatis Generator -->  <dependency>   <groupId>org.mybatis.generator</groupId>   <artifactId>mybatis-generator-core</artifactId>   <version>1.3.2</version>   <scope>compile</scope>   <optional>true</optional>  </dependency>  <!--分页插件-->  <dependency>   <groupId>com.github.pagehelper</groupId>   <artifactId>pagehelper</artifactId>   <version>${pagehelper.version}</version>  </dependency>  <!--通用Mapper-->  <dependency>   <groupId>tk.mybatis</groupId>   <artifactId>mapper</artifactId>   <version>${mapper.version}</version>  </dependency>  <dependency>   <groupId>com.alibaba</groupId>   <artifactId>fastjson</artifactId>   <version>1.2.17</version>  </dependency> </dependencies> <repositories>  <repository>   <id>repo.spring.io.milestone</id>   <name>Spring Framework Maven Milestone Repository</name>   <url>https://repo.spring.io/libs-milestone</url>  </repository> </repositories> <build>  <finalName>mybatis_generator</finalName>  <plugins>   <plugin>    <groupId>org.mybatis.generator</groupId>    <artifactId>mybatis-generator-maven-plugin</artifactId>    <version>1.3.2</version>    <configuration>     <verbose>true</verbose>     <overwrite>true</overwrite>    </configuration>   </plugin>   <plugin>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-maven-plugin</artifactId>    <configuration>     <mainClass>org.linuxsogood.sync.Starter</mainClass>    </configuration>   </plugin>  </plugins> </build></project>

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 资料下载
  • 历年真题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     807人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     351人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     314人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     433人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     221人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯