Skip to content
wangb edited this page Oct 31, 2018 · 1 revision

Overview

  • Bean
  • Configuration: provide beans
  • Autowire: auto create beans depend on
  • Component scan: auto discover component create as bean.
  • Autoconfiguartion: spring boot can determine what component need to be configured and wired together.

Application

  • @SpringBootApplication
  • @SpringBootConfiguration
  • @EnableAutoConfiguration
  • @ComponentScan: @Component, @Controller, @Service

Framework

  • core container
  • dependency injectionframework.
  • spring data: JPA
  • security

Web

  • RequestMapping, GetMapping etc
  • Model: is an object that ferries data between a controller and whatever view is charged with rendering that data.
  • PostMapping
    • @Valid and Errors // kotlin need @filed or @get before annotations
  • WebMvcConfigurer: shortcut for view without model

Data

  • /resources/schema.sql will be execute automaticlly create schema, /resources/data.sql automaticlly create data

JDBC (Java Database Connectivity)

  • JdbcTemplate: query
  • Model: data class
  • ModelRepository: query one and all, save
  • @Repository JdbcModelRepository:

JPA (Java Persistence API)

  • @Entity data class Model
  • @Id, @ManyToMany etc
  • @NotNull validation annotation
  • CrudRepository: automaticlly implemetion

Security

  • alt: shiro

Spring Security

  • auto configuration
  • WebSecurityConfigurerAdapter: add login form
  • User store: override configure
    • in-memory: testing
    • JDBC
    • LDAP
    • custom services
  • authentication
    • User: UserDetails
    • getAuthorities

Configuration properties

  • environment abstraction

REST

  • RestContorller
  • @PathVariable: url param
  • @RequestBody: body param

Consume REST Api

  • RestTemplate: sync
  • WebClient: async
Clone this wiki locally