zoukankan      html  css  js  c++  java
  • 如何优化SpringBoot的项目的启动速度

    日常开发SpringBoot项目启动类都用@SpringBootApplication,实际上它是下面三个注解的组合:
    启动慢往往跟@ComponentScan和@EnableAutoConfiguration加载的内容太多有关,一种方法是不用这两个注解,通过@import注解精确指定要加载扫描的类,但要加载的类多时又很麻烦,
    可以用@SpringBootApplication注解下面的属性:
    • exclude: Exclude the list of classes from the auto configuration.
    • excludeNames: Exclude the list of fully qualified class names from the auto configuration. This parameter added since spring boot 1.3.0.
    • scanBasePackageClasses: Provide the list of classes that has to be applied for the @ComponentScan.
    • scanBasePackages Provide the list of packages that has to be applied for the @ComponentScan. This parameter added since spring boot 1.3.0.
    另外,如果SpringBoot项目启动很慢,可能意味着你要重新拆分微服务。
  • 相关阅读:
    eclipse历史版本下载地址
    注解@SuppressWarnings
    VB创建文件夹
    VB学习生成JavaBean
    C++下的强制转换类型
    Django扩展
    数据查询操作
    深入剖析C++多态、VPTR指针、虚函数表
    快速排序一步一步优化
    cookie与session
  • 原文地址:https://www.cnblogs.com/doit8791/p/11421971.html
Copyright © 2011-2022 走看看