Guns项目整体结构

1、模块结构

四个模块

①  admin——后台管理模块

②  core——所有模块都能使用的工具类,常用类

③  parent——maven的父模块,所有项目的依赖都可以提到parent中统一依赖配置

④  rest——提供对接服务端接口的支持,利用jwt token鉴权机制,给予客户端的访问权限,传输数据用md5加密

2、包结构

├─main
│  │  
│  ├─java
│  │   │
│  │   ├─com.stylefeng.guns----------------项目主代码
│  │   │          │
│  │   │          ├─common----------------项目公用的部分(业务中经常调用的类,例如常量,异常,实体,注解,分页类,节点类)
│  │   │          │
│  │   │          ├─config----------------项目配置代码(例如mybtais-plus配置,ehcache配置等)
│  │   │          │
│  │   │          ├─core----------------项目运行的核心依靠(例如aop日志记录,拦截器,监听器,guns模板引擎,shiro权限检查等)
│  │   │          │
│  │   │          ├─modular----------------项目业务代码
│  │   │          │
│  │   │          ├─GunsApplication类----------------以main方法启动springboot的类
│  │   │          │
│  │   │          └─GunsServletInitializer类----------------用servlet容器启动springboot的核心类
│  │   │
│  │   └─generator----------------mybatis-plus Entity生成器
│  │
│  ├─resources----------------项目资源文件
│  │     │
│  │     ├─gunsTemplate----------------guns代码生成模板
│  │     │ 
│  │     ├─application.yml----------------springboot项目配置
│  │     │ 
│  │     └─ehcache.xml----------------ehcache缓存配置
│  │
│  └─webapp----------------web页面和静态资源存放的目录
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据提供的引用内容,我们可以得知guns redis集群的实现需要进行以下两个步骤: 1.在命令行中启动redis集群,具体步骤如下: ```shell # 下载redis源码 wget http://download.redis.io/releases/redis-5.0.5.tar.gz # 解压 tar xzf redis-5.0.5.tar.gz cd redis-5.0.5 # 编译 make # 启动redis集群 ./src/redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 ``` 2.修改guns项目的配置文件,使其支持redis集群。具体步骤如下: 修改guns\guns-admin\src\main\resources\application.yml文件,添加以下配置: ```yaml spring: redis: cluster: nodes: - 127.0.0.1:7000 - 127.0.0.1:7001 - 127.0.0.1:7002 - 127.0.0.1:7003 - 127.0.0.1:7004 - 127.0.0.1:7005 ``` 修改guns\guns-admin\src\main\java\com\stylefeng\guns\config\web\WebConfig.java文件,启用RedisHttpSession: ```java @Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Bean public RedisHttpSessionConfiguration redisHttpSessionConfiguration() { RedisHttpSessionConfiguration configuration = new RedisHttpSessionConfiguration(); configuration.setMaxInactiveIntervalInSeconds(1800); return configuration; } @Bean public JedisConnectionFactory connectionFactory() { JedisConnectionFactory connection = new JedisConnectionFactory(); connection.setHostName("127.0.0.1"); connection.setPort(6379); return connection; } @Bean public HttpSessionStrategy httpSessionStrategy() { return new HeaderHttpSessionStrategy(); } } ```

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值