2小时学会Spring Boot--慕课网

1-1 spring boot介绍

      spring boot spring cloud

       课程介绍

       1  第一个spring boot程序

       2 自定义属性配置

       3 controller的使用

       4 spring-data-jpa

       5 事务管理

      (前置知识:1 利用maven 构建项目 2 spring 注解 3 RESTful API)

2-1第一个springboot应用

  旗舰版,开源版

    网页项目配置网址:https://start.spring.io/

      因为有些配置问题,没有解决,搭建了最简单只有web依赖,增加一个controller访问方法:https://blog.csdn.net/Crazer_cy/article/details/79598066 

3-1 项目属性配置

     server.port=8081

     server.    

 4-1 Controller的使用

     @Controller:处理http请求

     @RestController:spring 4之后新加的注解,原来返回json需要@ResponseBody配合@Controller

     @RequestMapping:配置url映射

   @RequestMapping需要和模板搭配使用,

  

     设置RequestMapping,访问hello,或者访问hi,都可以连接到say()方法

     

5-1 数据库操作

    

          

server.port=8081
#application.properties
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.url=jdbc:mysql://127.0.0.1:3308/dbgirl
spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true

5-2 数据库操作下

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  

posted @ 2018-08-02 09:45  死磕战队  阅读(225)  评论(0)    收藏  举报