摘要:
在Spring Boot中自定义filter 本文我们将会讲解如何在Spring Boot中自定义filter并指定执行顺序。 定义Filter很简单,我们只需要实现Filter接口即可,同时我们可指定@Order来确定其执行顺序,我们定义两个filter如下: @Slf4j @Component 阅读全文
摘要:
Spring Boot启动的时候会在命令行生成一个banner,其实这个banner是可以自己修改的,本文将会将会讲解如何修改这个banner。 首先我们需要将banner保存到一个文件中,网上有很多可以生成banner文件的网站,比如:patorjk.com/software/taag 我们生成了 阅读全文
摘要:
文章目录Shutdown Endpointclose Application Context退出SpringApplication从外部程序kill App Shutdown SpringBoot App Spring Boot使用ApplicationContext来创建,初始化和销毁所用的bea 阅读全文
摘要:
文章目录Spring Boot的exit code自定义Exit CodesExitCodeGeneratorExitCodeExceptionMapperExitCodeEvent Spring Boot的exit code 任何应用程序都有exit code,这个code是int值包含负值,在本 阅读全文
摘要:
文章目录依赖条件data.sql文件schema.sql 文件@sql注解@SqlConfig 注解 在Spring Boot中加载初始化数据 在Spring Boot中,Spring Boot会自动搜索映射的Entity,并且创建相应的table,但是有时候我们希望自定义某些内容,这时候我们就需要 阅读全文
摘要:
文章目录简介添加依赖关系一个简单的例子属性嵌套@ConfigurationProperties和@Bean属性验证属性转换自定义Converter SpringBoot @ConfigurationProperties详解 简介 本文将会详细讲解@ConfigurationProperties在Sp 阅读全文
摘要:
文章目录简介使用注解注册一个Properties文件使用属性文件Spring Boot中的属性文件@ConfigurationPropertiesyaml文件Properties环境变量java代码配置 Spring Boot中的Properties 简介 本文我们将会讨怎么在Spring Boot 阅读全文
摘要:
文章目录开始使用Spring Boot Actuator开始使用ActuatorHealth Indicators/info 入口/metrics入口自定义Endpoint扩展现有的Endpoints Spring Boot Actuator Spring Boot Actuator 在Spring 阅读全文
摘要:
文章目录添加maven依赖TestRestTemplate VS RestTemplate使用Basic Auth Credentials使用HttpClientOption使用RestTemplateBuilder Spring Boot的TestRestTemplate使用 TestRestTe 阅读全文
摘要:
文章目录简介添加maven依赖Repository测试Service测试测试Controller@SpringBootTest的集成测试 Spring Boot中的测试 简介 本篇文章我们将会探讨一下怎么在SpringBoot使用测试,Spring Boot有专门的spring-boot-start 阅读全文
摘要:
文章目录添加Spring Boot starters添加应用程序入口Import Configuration和Components迁移应用程序资源迁移应用程序属性文件迁移Spring Web程序 从Spring迁移到Spring Boot Spring Boot给我们的开发提供了一系列的便利,所以我 阅读全文
摘要:
文章目录添加依赖配置端口配置Context Path配置错误页面在程序中停止Spring Boot配置日志级别注册Servlet切换嵌套服务器 在Spring Boot中配置web app 本文将会介绍怎么在Spring Boot中创建和配置一个web应用程序。 添加依赖 如果要使用Spring w 阅读全文
摘要:
文章目录添加Maven依赖创建自定义 Auto-Configuration添加Class Conditions添加 bean ConditionsProperty ConditionsResource ConditionsCustom Conditions测试停止自动配置 自定义spring boo 阅读全文
摘要:
Spring Boot @EnableAutoConfiguration和 @Configuration的区别 在Spring Boot中,我们会使用@SpringBootApplication来开启Spring Boot程序。在之前的文章中我们讲到了@SpringBootApplication相当 阅读全文
摘要:
Scala的Higher-Kinded类型 Higher-Kinded从字面意思上看是更高级的分类,也就是更高一级的抽象。我们先看个例子。 如果我们要在scala中实现一个对Seq[Int]的sum方法,应该怎么做呢? def sum(seq: Seq[Int]): Int = seq reduce 阅读全文

