springboot
jsq6681993
这个作者很懒,什么都没留下…
展开
-
springboot 集成logback
springbootlogback参考文档:https://blog.csdn.net/flysun3344/article/details/80555746一、application.properties1、logging.level默认info如果设置全部使用logging.level.root=*不能作为通配符2、logging.file 和 logging.path,如果配置了logging.file,logging.path就无效了;logging.path只是配置日志文件的路径原创 2021-11-14 13:30:18 · 1576 阅读 · 0 评论 -
spring 过滤器和拦截器实现修改请求体中的参数数据
spring通过过滤器和拦截器实现修改请求体中的参数数据:https://www.jb51.net/article/216183.htm原创 2021-08-15 20:30:01 · 1530 阅读 · 0 评论 -
RequestBodyAdvice用法详解-参数加解密示例
在实际项目中,我们常常需要在请求前后进行一些操作,比如:参数解密/返回结果加密,打印请求参数和返回结果的日志等。这些与业务无关的东西,我们不希望写在controller方法中,造成代码重复可读性变差。这里,我们讲讲使用@ControllerAdvice和RequestBodyAdvice、ResponseBodyAdvice来对请求前后进行处理(本质上就是AOP),来实现日志记录每一个请求的参数和返回结果。实现步骤1、声明一个类型,加上@ControllerAdvice注解,类实现接口RequestBo原创 2021-08-15 20:07:32 · 14350 阅读 · 0 评论 -
@ConditionalOnProperty的作用和用法
在spring boot中有时候需要控制配置类是否生效,可以使用@ConditionalOnProperty注解来控制@Configuration是否生效.说明@Retention(RetentionPolicy.RUNTIME)@Target({ ElementType.TYPE, ElementType.METHOD })@Documented@Conditional(OnPropertyCondition.class)public @interface ConditionalOnPr原创 2020-12-23 22:29:11 · 763 阅读 · 0 评论 -
IDEA 启动spring boot项目报错java.lang.ClassNotFoundException: javax.servlet.ServletContext
在IntelliJ IDEA里建了个Maven项目(用的spring boot)创建项目时操作跟之前在eclipse操作步骤基本差不多;IDEA配置的spring boot项目的tomcat依赖为 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat&l原创 2020-12-23 22:12:37 · 2714 阅读 · 1 评论 -
springboot接收日期字符串参数与返回日期字符串类型格式化
接口请求接收日期字符串方式一 全局注册自定义Formatter@Configurationpublic class WebConfig implements WebMvcConfigurer { @Override public void addFormatters(FormatterRegistry registry) { registry.addFormatter(new Formatter<Date>() { @Override原创 2020-09-27 14:56:39 · 2320 阅读 · 0 评论