spring-boot

Spring Aop

techzealot
Spring AOP AOP实现模式 动态代理 jdk cglib AspectJ静态代理 aspectj compiler AOP失效 动态代理模式下

Springboot参数校验及异常处理

techzealot
Springboot参数校验及相关异常处理 不同类型参数校验 实体添加校验规则 @Data public class User { @NotNull(message = "name不能为空") private String name; @Range(min = 0, max = 120, message = "必须在0-120之间") private int age; } 通过query string传递的参数 需要在Controller上加上@Validated注解否则不会触发校验规则

Springboot

techzealot
springboot知识总结 bootstrap phase bootstrap阶段是springboot中为应用容器准备启动环境的阶段。该阶段最先运行,会产生BootstrapContext,为ApplicationContext准备配置文件,加载其他需要资源。BootstrapContext为ApplicationContext的父容器,其中的配置属性和Bean对于子容器均可见。该阶段会读取bootstrap.yml(properties)配置文件并存储于BootstrapContext,以便与ApplicationContext相关配置隔离。 应用: 配置远程配置中心地址并从中获取应用配置,如Apollo和spring cloud config 可以作为测试上下文所需资源的承载环境,如**testcontainers-spring-boot** 注意事项: