
SpringBoot
文章平均质量分 51
SpringBoot
=蜗牛=
这个作者很懒,什么都没留下…
展开
-
Spring Boot 启动成功
一、简介有时候需要在项目启动成功后执行一些特殊的任务。例如初始化参数、数据库初始化等操作。Spring Boot提供了两种解决方案:CommandLineRunner和ApplicationRunner。二、ApplicationRunner@Slf4j@Componentpublic class SpringBootApplicationRunner implemen...原创 2020-02-28 11:31:53 · 5425 阅读 · 0 评论 -
如何在 IntelliJ IDEA 中安装 Lombok 插件,让你的代码更简洁易读
一、简介Lombok项目是一个Java库,它会自动插入编辑器和构建工具中,Lombok提供了一组有用的注释,用来消除Java类中的大量样板代码。常用注解:@Setter :注解在类或字段,注解在类时为所有字段生成setter方法,注解在字段上时只为该字段生成setter方法。@Getter :使用方法同上,区别在于生成的是getter方法。@ToString :注解在类,添加t...原创 2020-02-28 10:26:36 · 5829 阅读 · 1 评论 -
Spring Boot 异步任务
一、简介二、Spring Boot异步任务第一步:开启异步任务,启动类添加@EnableAsync@EnableAsync@SpringBootApplicationpublic class WoniuCsdnSpringbootApplication { public static void main(String[] args) { Spring...原创 2020-02-28 10:08:42 · 328 阅读 · 0 评论 -
Spring Boot 读取配置文件
一、简介二、使用@value读取配置文件第一步:创建DemoController@RestController@RequestMapping("/demo")public class DemoController { @Value("${server.port}") private String port; @GetMapping("/getPo...原创 2020-02-27 16:24:50 · 2129 阅读 · 0 评论 -
快速上手:使用 IDEA 和 Maven 搭建 SpringBoot 项目的完整指南
一、简介IDEA 全称 IntelliJ IDEA,是java编程语言开发的集成环境。IntelliJ在业界被公认为最好的java开发工具,尤其在智能代码助手、代码自动提示、重构、J2EE支持、各类版本工具(git、svn等)、JUnit、CVS整合、代码分析、 创新的GUI设计等方面的功能可以说是超常的。Maven项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档...原创 2020-02-27 13:54:42 · 33550 阅读 · 3 评论