Coder Social home page Coder Social logo

my-springboot's Introduction

my-springBoot

自己造的SpringBoot轮子

介绍

模仿 Spring Boot 写的一个轻量级的 HTTP 框架。

内置由 Netty 编写 HTTP 服务器,无需额外依赖 Tomcat 之类的 web 服务器。使用 Netty 几十行代码即可实现一个简易的 HTTP 服务,性能高且轻量。

为什么要写?

写这个东西只是自己个人的兴趣爱好使然,,主要目的还是为了提高自己的编码能力。

特点

  1. 内置由 Netty 编写 HTTP 服务器,无需额外依赖 Tomcat 之类的 web 服务
  2. 代码简洁,可读性好
  3. 支持 Spring MVC 常用的注解,用法也和 Spring MVC 基本一样
  4. 后端只返回 json 数据给前端
  5. 集成了 checkstyle 、spotbugs、pmd 并设置了 commit 钩子来保证代码质量

功能实现

Get 请求和 POST 请求处理

  • @GetMapping : 处理 Get 请求
  • @PostMapping :处理 Post 请求
  • @RequestBody : 接收前端传递给后端的 json 字符串
  • @RequestParam :获取 Get 请求的 URL 查询参数
  • @PathVariable : 获取 URL 中的参数/占位符

IOC

  • @Autowired :注入对象
  • @Component:声明对象被 IOC 容器管理
  • @Qualifier: 指定注入的bean
  • 解决循环依赖问题

AOP

  • @Aspect
  • @Pointcut
  • @Before
  • @After
  • @Order
  • @AfterReturning
  • @AfterThrowing
  • 支持自定义的注解

拦截器

  • 支持拦截实现某个接口的所有 bean(基于 JDK 动态代理)
  • 支持拦截某个没有实现任何接口的 bean(基于 CGLIB 动态代理)
  • 支持全局拦截器(拦截所有 bean)
  • 支持配置多个拦截器
  • 支持自定义拦截器的执行顺序

异常处理

  • @ControllerAdvice
  • @ExceptionHandler

配置文件读取

  • 支持读取 yaml 以及 properties 类型的文件

其他

  • @SpringBootApplication
  • @Configuration
  • @Bean

代码质量

  • 集成 checkstyle
  • 集成 spotbugs
  • 设置 commit 钩子
  • 提高测试覆盖率,增加代码稳定性,为重构提供保障

功能演示

查看src\main\java\com\github\feiyongjing\service\spring\dome

my-springboot's People

Contributors

feiyongjing avatar

Watchers

 avatar  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.