SpringBoot程序优化
- 延迟初始化Bean
spring:
main:
lazy-initialization: true
- 创建扫描索引
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-indexer</artifactId>
<optional>true</optional>
</dependency>
//在启动类中添加注解@Indexed
@Indexed
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}