Due to the recent work requirements, using Spring boot to project development, are summarized below.
Spring boot Introduction, https: //blog.csdn.net/qq_32403063/article/details/87948084
Spring boot project creation, https: //www.cnblogs.com/chansblogs/p/9293360.html, use the idea to create a personal project
Spring boot project structure, https: //blog.csdn.net/XWGXF_JJX/article/details/90742852, there Config, to configure the Bean
Spring boot using jpa link mysql, https: //blog.csdn.net/u014553029/article/details/80971878, reference configuration
Spring boot operation of the database using Jpa way. It is divided into three steps:
1) create an entity class, you need to clear the entity class and specify the table name.
2) Create Dao layer interfaces need to integrate two classes
3) Creating Service Layer, specifically for the service layer
4) Controller provide external interfaces
Jpa often call using RDS data in two ways, one is the default jpa carrying method, one is used in the Dao Sql layer. Use sql reference,
Personally like the default built-in method, but sometimes using sql task easier.
Controller default rule layer, GET method request data. Post method to send data, DETELE delete method, PUT method changes.
GET method, commonly / api / {userId} and the like, other methods commonly used objects.
@Entity, indicate the type entity class
@Table (name = "1"), a reference table indicating the entity class
@PathVariable ( "a") controller layer reference http request parameters a
@RequestParm ( "" a "") controller using the http request? Parameters No.
@Repository, a layer Dao
@RestController, a controller, indicated that it is required to access http request
@Autowired, class registration
@Service, the services layer, the service class is indicated
@ RequestMapping, http access path
@Column (name = "id") indicate the corresponding field in the class to which the entity field in the database
@Bean registered in the config, you can use Autowired be spring boot Register.