All Projects → yujunhao8831 → Spring Boot Start Current

yujunhao8831 / Spring Boot Start Current

Licence: apache-2.0
Spring Boot 脚手架 Mybatis Spring Security JWT 权限 Spring Cache + Redis

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Spring Boot Start Current

Pybbs
更实用的Java开发的社区(论坛),Better use of Java development community (forum)
Stars: ✭ 1,242 (+404.88%)
Mutual labels:  redis, spring-boot, spring-security
Milkomeda
Spring extend componets which build from experience of bussiness, let developers to develop with Spring Boot as fast as possible.(基于Spring生态打造的一系列来自业务上的快速开发模块集合。)
Stars: ✭ 117 (-52.44%)
Mutual labels:  redis, spring-boot, spring-security
Spring 5 Examples
This repository is contains spring-boot 2 / spring framework 5 project examples. Using reactive programming model / paradigm and Kotlin
Stars: ✭ 87 (-64.63%)
Mutual labels:  redis, spring-boot, spring-security
Dsock
Distributed WebSocket broker
Stars: ✭ 197 (-19.92%)
Mutual labels:  redis, websocket, distributed
Tutorial
Spring Boot的例子,包含RESTful API, MVC, JMS, Cache, Mybatis, Cache, Websocket...
Stars: ✭ 215 (-12.6%)
Mutual labels:  spring-boot, websocket, spring-security
Eshop Soa
EShop基于Dubbo实现SOA服务化拆分,并基于RocketMQ解决了分布式事务(新版SpringBootSOASkeleton)
Stars: ✭ 65 (-73.58%)
Mutual labels:  redis, spring-boot, spring-security
Mall
mall项目是一套电商系统,包括前台商城系统及后台管理系统,基于SpringBoot+MyBatis实现,采用Docker容器化部署。 前台商城系统包含首页门户、商品推荐、商品搜索、商品展示、购物车、订单流程、会员中心、客户服务、帮助中心等模块。 后台管理系统包含商品管理、订单管理、会员管理、促销管理、运营管理、内容管理、统计报表、财务管理、权限管理、设置等模块。
Stars: ✭ 54,797 (+22175.2%)
Mutual labels:  redis, spring-boot, spring-security
His
HIS英文全称 hospital information system(医院信息系统http://59.110.234.89:9999/swagger-ui.html ),医疗信息就诊系统,系统主要功能按照数据流量、流向及处理过程分为临床诊疗、药品管理、财务管理、患者管理。诊疗活动由各工作站配合完成,并将临床信息进行整理、处理、汇总、统计、分析等。本系统包括以下工作站:门诊医生工作站、药房医生工作站、医技医生工作站、收费员工作站、对帐员工作站、管理员工作站。需求为东软提供的云医院。
Stars: ✭ 359 (+45.93%)
Mutual labels:  redis, spring-boot, spring-security
Websocketdemo
在Spring Boot中使用WebSocket,示例包括简单模式、STOMP模式消息、处理对方不在线情况、分布式WebSocket等。
Stars: ✭ 140 (-43.09%)
Mutual labels:  spring-boot, websocket, distributed
Jiiiiiin Security
一个前后端分离的内管基础项目
Stars: ✭ 132 (-46.34%)
Mutual labels:  redis, spring-boot, spring-security
Springboot Project
这是一个用SpringBoot+JPA打造的基于微信服务号平台的点餐系统的后端,前端是一个使用Vue.js构建的运行于微信公众号的WebApp。前后端完全分离,前后端之间通过RESTful风格的接口相连。
Stars: ✭ 1,034 (+320.33%)
Mutual labels:  redis, spring-boot, websocket
Meetingfilm
基于微服务架构的在线电影购票平台
Stars: ✭ 149 (-39.43%)
Mutual labels:  redis, spring-boot, jwt-token
Javaquarkbbs
基于Spring Boot实现的一个简易的Java社区
Stars: ✭ 755 (+206.91%)
Mutual labels:  redis, spring-boot, websocket
Blog
一款简洁响应式博客系统
Stars: ✭ 72 (-70.73%)
Mutual labels:  redis, spring-boot, spring-security
Taroco
整合Nacos、Spring Cloud Alibaba,提供了一系列starter组件, 同时提供服务治理、服务监控、OAuth2权限认证,支持服务降级/熔断、服务权重,前端采用vue+elementUI+webpack,可以很好的解决转向Spring Cloud的一系列问题。
Stars: ✭ 545 (+121.54%)
Mutual labels:  redis, spring-boot, spring-security
Webfluxtemplate
Spring Webflux template application with working Spring Security, Web-sockets, Rest, Web MVC, and Authentication with JWT.
Stars: ✭ 107 (-56.5%)
Mutual labels:  spring-boot, websocket, spring-security
Spring Boot Demo
spring boot demo 是一个Spring Boot、Spring Cloud的项目示例,根据市场主流的后端技术,共集成了30+个demo,未来将持续更新。该项目包含helloworld(快速入门)、web(ssh项目快速搭建)、aop(切面编程)、data-redis(redis缓存)、quartz(集群任务实现)、shiro(权限管理)、oauth2(四种认证模式)、shign(接口参数防篡改重放)、encoder(用户密码设计)、actuator(服务监控)、cloud-config(配置中心)、cloud-gateway(服务网关)等模块
Stars: ✭ 323 (+31.3%)
Mutual labels:  redis, spring-boot, spring-security
Dokit
基于 Spring Boot2、 Jpa、 Spring Security、JWT、redis、Vue的前后端分离的后台管理系统开发平台, 用户管理、菜单管理、角色管理、字典管理、权限控制的方式为RBAC,操作日志、异常日志、接口限流、项目支持数据权限管理,支持一键生成前后端代码(支持在线预览及打包下载),支持前端菜单动态路由 可一键部署服务器应用,数据库。系统中活跃用户状态监控,监视当前系统CPU、内存、磁盘、堆栈等相关信息,基于Element UI在线表单设计及生成Vue代码。
Stars: ✭ 348 (+41.46%)
Mutual labels:  redis, spring-boot, websocket
Sk Admin
基于 Spring Boot、 Spring Data JPA、 Spring Security、Vue 的前后端分离的管理系统。项目采用模块开发方式, 主要模块:权限管理 (RBAC(Role-Based Access Control,基于角色的访问控制),支持数据字典、数据权限管理、前端菜单支持动态路由)、日志管理、代码生成器、系统监控、云存储管理、系统工具等等
Stars: ✭ 130 (-47.15%)
Mutual labels:  redis, spring-boot, spring-security
Okhelper Service
OK帮 云进销存 (SpringBoot Restful 全家桶)
Stars: ✭ 146 (-40.65%)
Mutual labels:  redis, spring-boot, jwt-token

Spring Boot 基础骨架

  • 升级到 spring boot 2.0

项目可以打成jar部署,也可以打成war部署,默认使用jar

<groupId>com.goblin</groupId>
    <artifactId>goblin-restful-client</artifactId>
    <!--<packaging>war</packaging>-->
<packaging>jar</packaging>

也可以用Docker部署,要求

  • 本地含有Docker,启动状态
  • Docker包含JDK1.8,如没有安装即可
docker pull java

maven打包命令 : mvn clean package docker:build

项目所用技术

  • Spring
  • Spring Boot
  • Spring MVC
  • Spring Session(已不使用,项目无状态)
  • Spring Security
  • Spring Cache
  • Spring Boot Admin
  • Hibernate Validator
  • Mybatis Plus
  • Redis
  • Swagger(已废弃)
  • Pagehelper
  • Druid
  • Log4j2
  • WebSocket
  • JWT(JSON Web Tokens)
  • WebSocket
  • jasypt 配置文件加密

项目包含了

  • 分布式锁
  • 分布式唯一code构建
  • 分布式session共享(已不使用,项目无状态)
  • 异步处理
  • Aop缓存
  • 基础CRUD
  • 物理分页
  • 异步日志,多线程下用户的会话跟踪
  • Swagger restful api
  • 异常统一处理
  • Cors解决跨域
  • 注入攻击拦截器
  • 多环境配置
  • 基本工具类
  • jwt认证
  • Spring Security基础权限管理
  • 细粒度权限控制(粒度控制到字段)
  • 验证码
  • Spring Boot Admin 管理和监视
  • 极简分布式任务调度
  • WebSocket 简单示例

要求 :

  • JDK 1.8
  • redis 默认使用 127.0.0.1:6379
  • mysql root/12345678 127.0.0.1:3306 数据库名称 : goblin,基础sql见init.sql
  • lombok 插件(eclipse IntelliJ IDEA),不然项目可能会报错,但是不影响运行

权限

Spring Security在这里仅仅只是用来认证(登录认证).

细粒度的权限是自行实现,resources/manage_system.pdm可以自行查看 manage_permission_resource, manage_role, manage_role_permission_resource, manage_user, manage_user_role 代码中 AdminPermissionInterceptor 进行拦截控制,具体看代码实现,都有注释.

这里没有后台页面,权限的管理需要自行设计页面处理,或者自己插入脚本.

项目无状态

不使用session

com.goblin.ContextUtils

用户相关数据从 ContextUtils 中获取

数据交互

org.springframework.http.ResponseEntity

使用ResponseEntity对数据进行封装

代码生成器

goblin-generator
|---src
|   |---test
         |---com
              |---goblin
                   |---generator
                       |---...

注意,所有状态,类型等字段,请使用枚举

比如 : String resourceType(API:接口,MENU:菜单,BUTTON:按钮)
这样的字段在实体中使用枚举类型

创建枚举

相应的枚举,注释必须完整 注:

  • 枚举放入domain.enum包下
/**
 * 资源类型(API:接口,MENU:菜单,BUTTON:按钮)
 * <p>
 * 对应字段 {@link com.goblin.domain.PermissionResource#resourceType}
 */
@Getter
public enum ResourceType implements IEnum {
    
    API( "API" , "接口" ),
    MENU( "MENU" , "菜单" ),
    BUTTON( "BUTTON" , "按钮" );

    /** 数据库存储值 **/
    private String value;
    /** 相应注释 **/
    private String comment;

    ResourceType ( String value , String comment ) {
        this.value = value;
        this.comment = comment;
    }

    /**
     * {@link JsonValue} 指定序列化为该字段,也就是显示时以该字段显示
     */
    @JsonValue
    public String getComment () {
        return comment;
    }
}

实体中声明

public class PermissionResource {
    private Long id;
    private ResourceType resourceType;
    // ... ... 
}

配置枚举包位置

mybatis-plus:
  type-enums-package: com.goblin.manage.bean.domain.enums

使用 mybatis plus

文档 http://mp.baomidou.com

  • 注意 : 分页不适用mybatis plus的分页,使用PageHelper,mybatis plus分页对多表查询的分页支持不够

查询分页(PageHelper)

https://pagehelper.github.io

示例 :

// controller
@GetMapping
public ResponseEntity< PageInfo > listPage ( PageRowBounds pageRowBounds ) {
    return ResponseEntityPro.ok(userService.listPage( pageRowBounds ) );
}

// service
public PageInfo listPage ( PageRowBounds pageRowBounds ) {
    PageHelper.startPage( pageRowBounds.getOffset(), pageRowBounds.getLimit() );
    return new PageInfo( super.selectList( null ) );
}

api返回指定/排除字段

示例 :

// 排除指定字段
@GetMapping
public ResponseEntity< PageInfo > listPage ( PageRowBounds pageRowBounds ) {
    return ResponseEntityPro.ok(userService.listPage( pageRowBounds ) ,"-password,-realName" );
}

// 只返回指定字段
@GetMapping
public ResponseEntity< PageInfo > listPage ( PageRowBounds pageRowBounds ) {
    return ResponseEntityPro.ok(userService.listPage( pageRowBounds ) ,"password,realName" );
}

api权限返回指定/排除字段

# 见 resource_api_uri_show_fields 字段
SELECT * FROM manage_role_permission_resource;

流程控制

接口对内使用Exception处理 AssertUtils

AssertUtils.isTrue( condition , "操作失败." );

接口对外使用if else流程控制

配置文件加密

  • 引入依赖

    • pom.xml
<dependency>
    <groupId>com.github.ulisesbocchio</groupId>
    <artifactId>jasypt-spring-boot-starter</artifactId>
    <version>版本 https://github.com/ulisesbocchio/jasypt-spring-boot 获取最新的</version>
</dependency>
  • 设置用于加密/解密属性的主密码

    • 配置文件中设置
jasypt:
  encryptor:
    password: goblin
  • 加密

    • JasyptStringEncryptorTest.java
@RunWith( SpringRunner.class )
@SpringBootTest
public class JasyptStringEncryptorTest {

	@Autowired
	private StringEncryptor stringEncryptor;

	@Test
	public void name () throws Exception {
		final String username = stringEncryptor.encrypt( "root" );
		final String password = stringEncryptor.encrypt( "root" );

		System.err.println( "username = " + username );
		System.err.println( "password = " + password );

	}
}
  • 使用

    • 格式 : ENC(需要解密的字符串)
spring:
  datasource:
    username: ENC(jEmjzNoC9rTYorAj5mI84A==)
    password: ENC(jEmjzNoC9rTYorAj5mI84A==)

项目介绍

版本

  • goblin-parent 控制版本

公共模块

其实这些模块,在这里体现不出什么,这里就一个goblin-manage-system服务,其实可以全部写到goblin-manage-system里面就行了,这样看起来就简单很多. 因为自己用过Spring Cloud进行开发,这里只是为了以后多服务方便.

  • goblin-basic-config 公共配置模块
  • goblin-cache 缓存模块
  • goblin-common 工具模块
  • goblin-security 安全模块

代码生成

  • goblin-generator

监控

  • goblin-admin-ui

服务

  • goblin-manage-system 主服务
  • goblin-scheduling 分布式调度服务,非常简单

启动

初始化数据库

执行 resources/init-mysql.sql(库名goblin,创建数据库时,记得设置编码为:UTF-8)

启动redis

默认使用 127.0.0.1:6379

项目

以下都可单独运行

goblin-admin-ui

用于监控服务,http://localhost:8888

goblin-manage-system

http://localhost:8080

  • DemoController 注入攻击,api返回指定/排除字段示例

  • DistributedDemoController 分布式锁以及异步处理的demo

  • EnumDemoController mybatis 枚举处理

  • LogDemoController aop

  • UserValidatorDemoController HibernateValidator 例子

  • WebSocketDemoController WebSocket例子

goblin-scheduling

简单调度

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].