
springboot+dubbo+redis+RabbitMQ 项目整合实例
项目 directories 结构描述 项目采用的技术列表 系统功能展示 具例代码 配置文件示例
发布日期:2021-05-19 16:42:51
浏览次数:24
分类:精选文章
本文共 2998 字,大约阅读时间需要 9 分钟。
Spring Boot 项目实战经验
从零开始到项目实战,共整理了一个完整的Spring Boot项目开发经验,将从项目结构到代码实现详细记录。以下是一些实用经验分享,供参考。
项目 directories 结构
Top-Level pom
-- api
:公共 API、DTO 等 jar-- foundation
:公共基设 jar-- modules
:前端 consumer pom-- www
:官网 jar-- admin
:后台 jar-- service
:服务 provider(可拆分)-- user
:用户中心 jar-- order
:订单中心 jar-- ...
使用技术
- Spring Boot
- Dubbo
- Zookeeper
- MyBatis
- Redis
- RabbitMQ
- Druid
- Swagger
项目截图示例
- [Swagger 接口文档](https://img-cdn.csdn.net/2018/07/02/0 getUser?watermark=2&text=aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L0RvbWVf)
- Dubbo 后台管理界面
- RabbitMQ 管理界面
示例代码
消费者(暴露给前端的 controller)
package com.ysk.admin.controller;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RestController;@RestController@RequestMapping("/")private class TestController { @Reference(version = "1.0.0") private UserService testService; @GetMapping("hello") public String hello() { return testService.sayHello("Hello springboot and dubbo!"); } @GetMapping("user") public User user() { return testService.findUser(); } @GetMapping("list") public Listlist(@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int pageSize) { return testService.getUser(page, pageSize); } @RequestMapping(method = RequestMethod.POST, value = "add") public List add(@RequestBody User user) { System.out.println(user.toString()); return null; } @GetMapping("getuserfromredis") public User getRedis(@RequestParam String key) { return testService.getUserForRedis(key); }}
Redis 配置
spring.datasource.url = jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8spring.datasource.username = rootspring.datasource.password = rootspring.datasource.driverClassName = com.mysql.jdbc.Driver#数据库连接池配置spring.datasource.initial-size=5spring.datasource.min-idle=5spring.datasource.max-idle=8spring.datasource.max-active=20spring.datasource.max-wait=60000spring.datasource.timeBetweenEvictionRunsMillis=60000spring.datasource.minEvictableIdleTimeMillis=300000spring.datasource.validationQuery=SELECT 1 FROM DUALspring.datasource.testWhileIdle=truespring.datasource.testOnBorrow=falsespring.datasource.testOnReturn=falsespring.datasource.poolPreparedStatements=truespring.datasource.maxPoolPreparedStatementPerConnectionSize=20
###{text本} 这篇文章主要讲述了一个基于Spring Boot的后台管理系统项目,涉及Dubbo分布式服务、Redis缓存、RabbitMQ消息队列等技术的应用。文章详细介绍了项目的目录结构、配置管理、代码实现以及使用的各种技术工具。同时,文章还附有部分代码示例和项目截图,展示了实际应用中的实现效果。
文章内容经过优化,去除了图片和链接,保留了文字内容,结构已稍作重新组织。内容虽无正式的小标题,但本质上可以视为对某个Spring Boot项目实战经验的详细描述。
从内容角度看,文章主要围绕以下几个方面展开:
文章保持ed Techincal内容不变,但以更加简洁易懂的方式呈现。对于技术背景较深的读者,本文依然能够提供不错的参考价值。而对于技术新手,本文也提供了一个可参考的项目框架和思路。
发表评论
最新留言
不错!
[***.144.177.141]2025年04月22日 23时32分32秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
【字节网盘】九款超好看不同页面404源码
2021-05-17
两款404页面自动跳转源码html
2021-05-17
ActivityNotFoundException异常错误
2021-05-17
laravel server error 服务器内部错误
2021-05-18
剑指 Offer 11. 旋转数组的最小数字
2021-05-18
一道简单的访问越界、栈溢出pwn解题记录
2021-05-18
响应的HTTP协议格式+常见的响应码
2021-05-18
遇到问题之-yum update无法连接镜像问题解决
2021-05-18
pycharm如何设置(错误、警告类的标准提醒)
2021-05-18
python入门到秃顶(10):异常
2021-05-18
百度背景换肤案例
2021-05-18
springboot redis key乱码
2021-05-19
idea thymeleaf页面变量报错解决
2021-05-19
Vue.js学习-15-v-for循环数组内容
2021-05-20
kafka超时错误或者发送消息失败等错误,排错方式
2021-05-20
sockjs-node/info?t=1462183700002 报错解决方案
2021-05-20
Latex 错误集合
2021-05-20
浏览器打开winscp 系统错误。代码:5。 拒绝访问。
2021-05-20