Day 2

Pronunciation

Gradle https://www.youtube.com/watch?v=KgsruLblTmc 1:21
Mybatis https://www.youtube.com/watch?v=JyythoOXdbU
HATEOAS https://www.youtube.com/watch?v=aThIuSsb_OA

Spring Boot Tuto

https://spring.io/guides/gs/rest-service/#scratch

功能流程与技术分辨

商品类别 HTTP GET

  • 子类,列表

商品信息 HTTP GET

  • 文字,图片

开团

  • 微信认证登录 (用户认证 (需考虑安全性问题)?) iOS/微信接口/返回微信身份信息?
  • 开团订单信息 HTTP GET
  • 支付iOS/微信支付接口/返回支付信息?
  • 收货地址iOS
  • 返回,邀请好友,返回 iOS
  • 返回开团订单信息 缓存

订单列表,订单详细信息HTTP GET

API Gateway: HTTP 请求入口HTTP服务器,设计API

  • 用户/登录服务: 用户/登录相关功能?微信用户静默登录数据?
  • 商品服务: 商品相关功能JSON
  • 订单服务: 订单相关功能JSON

编写单元测试,Cover所有的路径?

Meet REST

https://spring.io/understanding/REST
entity at a URI

  • use HTTP URIs to distinguish between nouns, or entities, in the system
  • HTTP URIs are a natural way to describe hierarchies, or relationship
    • REST API

https://spring.io/guides/tutorials/bookmarks/

  • Level2, 3?
  • URI
    • represent data
    • content-negotiation mechanism to deferred to http
    • manipulation depend on http methods
      • Get, Delete, Post, Put
  • Controller
    • map http request to methods
    • Spring MVC will extract those portions of the URI, and make them available as arguments of the same name that are passed to the controller method and annotated with @PathVariable
    • HttpMessageConverter s work in both directions: incoming requests bodies are converted to Java objects, and Java objects are converted into HTTP response bodies
      *validateUser UserNotFoundException HTTP status code (404) . Spring MVC provides a lotof different places to cleanly layer in generic, application-global and controller-local error handling logic.
  • Test: Spring MVC provides great support for unit testing HTTP endpoints. It provides a very nice middle ground between unit-testing and integration-testing. https://spring.io/guides/tutorials/bookmarks/

Design

功能流程 -> HTTP Methods

API

https://en.wikipedia.org/wiki/Representational_state_transfer#Uniform_interface
HATEOAS http://projects.spring.io/spring-hateoas/

Model

Record -> Entity Class-> SQL -> Spring Data repositories/Spring Data?
Spring MyBatis Integration?

  • CommandLineRunner

Securing

MySQL

https://dev.mysql.com/doc/refman/5.7/en/mysql-installation-windows-path.html
https://dev.mysql.com/doc/refman/5.7/en/tutorial.html

Mybatis + Spring Boot

http://www.mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/

Code

MySQL

MySQL: port 3306
root password yeweiya
user: newbieProject password: yeweiya
windows server name: MySQL57

MyBatis

http://www.mybatis.org/mybatis-3/getting-started.html

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容