- 为Spring 官方的构建工具。不同的用途,官方自动选择好指定的 starter,无需自己选择。
idea 使用步骤
- 以上以简单的web开发为例,选择了几个开发工具。
Spring Configuration Tools
- 用于实现配置文件的代码提示。前提:需要被注入属性的组件,注解了
@Component
(反正在容器内都行)、@ConfigurationProperties
- 为了防止导出工程的时候,带有这个工具(对部署的工程没什么卵用),可以在maven中添加一句话(中间
exclude
标签)<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <excludes> <exclude> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </exclude> <exclude> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> </exclude> </excludes> </configuration> </plugin> </plugins> </build>
Spring Boot DevTools
- 开发工具,开发的时候,不需要每次都restart,如果只是静态资源更新,那就不会重启。快捷键
ctrl+F9
Lombok
- 创建bean的神器,
@Data
注解在bean上之后,在编译的时候,就自动生成bean的setter
、getter
、toString
等每次都要手动生成的方法。@NoArgsConstructor
、@AllArgsConstructor
自动生成无参构造和有参构造(使用有参构造的时候必须带着无参构造,否则很容易出事)
连接超时
- idea使用该工具的时候,会发生连接超时的错误。解决方法如下:
参考来自这位大哥:大哥牛逼