大大饭

导航

02_springBoot 开发

1.springboot2

  自动化部署:

    start.spring.io 可以自己动生成Spring脚手架。也可以新建,有选项可选

    

    springBoot提供了统一的环境。通过配置文件可修改默认配置

    

    

 

 

 

   部署服务器时:

      这种部署:简化配置,方便运维。批量开关服务器。更适合做微服务

     

 

       其他的:就比较麻烦了

    

 

  

  @RequestMapping 注解

  Jrebel热部署

     

 

    简单的小项目springboot. 可以存储展示输入的名字

    

   

    Mybatis+SpringBoot

        

      application.properties

        spring.datasource.url=jdbc:mysql://localhost:3306/ssm?characterEncoding=utf8&useSSL=false&serverTimezone=UTC
        ##数据库用户名
        spring.datasource.username=root
        ##数据库密码
        spring.datasource.password=840416

        # 自动补全实体类包名称
        mybatis.type-aliases-package=com.mashibing.springboot.entity
        # 对应的sql映射
        mybatis.mapper-locations=classpath:mybatis/mapper/*.xml

      查找mapper接口

        在入口加入 MapperScan

          @MapperScan("com.mashibing.springboot.mapper")

        每一个mapper接口上加入

          @Mapper

      Mapper 自动生成

          MyBatis Generator

 

      实现分页查询

        依赖

          <!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter -->
          <dependency>
              <groupId>com.github.pagehelper</groupId>
              <artifactId>pagehelper-spring-boot-starter</artifactId>
              <version>1.2.12</version>
          </dependency>  

 

       

 

  

posted on 2021-05-10 12:03  大大饭  阅读(38)  评论(0编辑  收藏  举报