Giter Site home page Giter Site logo

spring-template's Introduction

项目说明

  • 个人 Spring 项目模板

技术说明

  • 持久层:JPA

集成依赖

  • swagger
  • lombok
  • mapstruct
  • snakeyaml
  • commons-lang3
  • hutool

功能描述

跨域处理

  • 配置 CorsConfig

Swagger中token验证配置

  • 配置 SwaggerConfigsecurityContextssecuritySchemes,开启安全验证

静态资源映射

  • 配置 ResourceHandlerConfigaddResourceHandleraddResourceLocations,形成映射关系

统一返回值处理

  • 配置 GlobalResponseAdvice,统一包装、返回数据

统一异常处理

  • 配置 GlobalExceptionHandler,统一处理、返回异常

拦截器配置

  • 编写具体拦截方法,参考 InterceptorTemplatepreHandle
  • 配置 InterceptorConfigaddInterceptors,添加指定拦截器的指定拦截路径

启动后的前置任务配置

  • 编写 PreTaskrun

非 Web 项目运行

  • 编写 NoWebApplicationrun
  • 可移除依赖 spring-boot-starter-web

通用CRUD

  • 编写 EnitityRepoServiceController 的基类与通用方法
  • 继承基类实现通用方法

通用条件查询

  • 配置CriteriaQueryWrapper、CriteriaQueryUtil,快速构建自定义条件查询

通用 Http 请求

  • 构建 HttpWrapper,使用 request,实现通用化参数包装与请求
  • 使用特定方法,参照 doGet 实现特定请求

Bean映射

  • 编写 Mapper,参照 MapperTemplate,实现符合MapStruct规范的转换接口

Application.yml切换

  • 配置 pom.xml 中的 profile 标签指向不同配置文件
  • 编写指定的配置文件
  • 通过 MavenProfiles 实现自由切换

spring-template's People

Contributors

chrisgray0626 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.