Code Monkey home page Code Monkey logo

simple-web-server's Introduction

让事情变得简单——基于spring-boot的简单的web服务端框架

为什么使用simple-web-server

回忆一下我们之前的Java服务端开发是什么样子的。
1.创建数据库表
2.根据表创建Entity类
3.创建一个Dao接口类
4.创建一个Dao实现类
5.创建一个Service接口类
6.创建一个Service实现类
7.创建一个Controller类
上面这些貌似没有什么问题,因为有代码生成工具啊。请接着往下看。
8.9.10.11....新增功能,Dao接口新增方法、Dao实现新增方法、Service接口新增方法、Service实现新增方法
只要有新的业务,不管业务多么简单都会一直循环上面的8.9.10.11.
要是业务修改起来包括了方法体的变动也是一步都不能少
上面这些对于有些人可能还不是问题,他说我的代码生成工具就厉害了,不光能生成类,还能直接把里面的常用方法也一起生成了
那我理解写代码生成工具的人可能是从一行代码5毛钱时代过来的,用生成的代码来骗钱呢。

说了这么多最正确的姿势应该是什么样子的呢?当然是不写代码就能实现功能,跟不写代码比较接近的就是写少量代码实现同样的功能咯!写少量代码的好处是显而易见的,出错率大大降低、开发时间大量减少、同时维护时间大量减少、更少的人力投入实现同样多的功能、同样多的人力投入实现更多的功能

简介

以spring boot,Mybatis为基础对数据库进行增删改查为前端提供rest接口,对于90+%的业务可以只有Entity类、Dao接口类、Service接口类、Controller类,其中Dao和Service不用实现任何方法,只要一个空类即可,用到了其中的泛型。业务可以灵活的写在Controller(简单的单个任务)或者Service(包含事物或者一些复杂的业务)中。在Controller中直接返回结果对象,会自动包装成前端需要的数据格式。使用异常(码)同前端进行交互。拥有绝对的好处同时对代码没有任何侵入性。代码极简、开发高效。适用前后端分离系统的后台、移动端后台等。适用于新系统(因为老系统中的spring等版本可能会有冲突)、微服务的一个新模块或重构中的模块。

示例 https://github.com/likeabook/simple-web-server-example

特性

0.90+%的业务不用写Service的实现、Dao的实现、Mapper.xml的实现
1.极简并灵活的CRUD调用
2.多表join查询
3.分页查询
4.异常码同rest结合
5.rest接口自动包装返回结果
6.无侵入性,随意集成其他第三方插件

计划中未实现功能

1.在新增时自动注入BaseEntity中的creatorId、creatorName、createTime
2.在修改和逻辑删除是自动注入BaseEntity中的modifierId、modifierName、modifyTime

simple-web-server's People

Contributors

likeabook avatar 407448555 avatar muyu8890 avatar

Watchers

James Cloos 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.