SpringBoot学习笔记(三)

SpringBoot学习笔记(三)

  1. SpringBoot热部署(ctrl+s保存后自动编译),导入以下jar包即可:

    <!--支持热部署 -->
    <dependency>
    	<groupId>org.springframework</groupId>
    	<artifactId>springloaded</artifactId>
    	<version>1.2.8.RELEASE</version>
    </dependency>
    <dependency>
    	<groupId>org.springframework.boot</groupId>
    	<artifactId>spring-boot-devtools</artifactId>
    </dependency>
    
  2. 将自己定义的类交给Spring管理:

    ​ (1)自己写的类上加注解@Configuration;

    ​ (2)在对外提供获取对象的方法getXxxx上加注解@Bean;SpringBoot学习笔记(三)_第1张图片

  3. Spring整合Mybatis-plus时yml文件配置:SpringBoot学习笔记(三)_第2张图片

  4. 利用SpringBoot创建web项目时,mapper层的接口需要在主启动类上添加@MapperScan(“xxx.xxx.mapper”)扫描.

你可能感兴趣的:(SpringBoot)