spring-boot启动加载数据库数据

概述

本文主要介绍如何在spring boot启动过程中初始化数据库数据的方法

使用注解

@Component
@Slf4j
public class InitSchemeDataConfig {

  @Resource
  private ConfigureRateMapper configureRateMapper;

  @Resource
  OrganizationBasicService organizationBasicService;

  @PostConstruct
  public void init() {
    System.out.println("系统启动中。。。");
    // DO SOMETHING ........
  }

  @PreDestroy
  public void destroy() {
    System.out.println("系统运行结束");
    // DO SOMETHING .......
  }

   Reprint policy


《spring-boot启动加载数据库数据》 by jackromer is licensed under a Creative Commons Attribution 4.0 International License
 Previous
cone edit 根据数据库数据快速创建类和文档 cone edit 根据数据库数据快速创建类和文档
简介 最近整理接口对接文档,发现复制粘贴太麻烦了,还是祭出coney edit吧,整理文档变得很轻松,尤其是接口文档的整理。 使用 有如下sql脚本 `color001` bigint(20) NOT NULL AUTO_INCREM
2019-10-16
Next 
sql优化和SQL特殊用法 sql优化和SQL特殊用法
简介 本文主要介绍mysql的一些常见关键字使用和注意事项,以及一些SQL优化标准和示例。 常见关键字 JOINleft right inner JOIN 这三个的差别就不多说了,主要用来做连表查询,往往会丢失性能。 GROUP BY
2019-09-05
  目录