随笔分类 -  SpringBoot And SpringCloud

摘要:前言: @Conditional是Spring4新提供的注解,它的作用是按照一定的条件进行判断,满足条件给容器注册bean。 @Conditional的定义: 从代码中可以看到,需要传入一个Class数组,并且需要继承Condition接口: Condition是个接口,需要实现matches方法, 阅读全文
posted @ 2021-09-03 17:25 甜菜波波 阅读(294) 评论(0) 推荐(0) 编辑
摘要:目录 1、@Import注解须知 2、@Import的三种用法 2.1、第一种用法:直接填class数组 2.2、第二种用法:ImportSelector方式【重点】 2.3、第三种用法:ImportBeanDefinitionRegistrar方式 3、@Import注解的三种使用方式总结 1、@ 阅读全文
posted @ 2021-09-03 14:42 甜菜波波 阅读(701) 评论(0) 推荐(0) 编辑
摘要:application.yml中加上 # springBoot+Mybatis 控制台打印SQL语句 (方式一) logging: level: com.zoctan.api.mapper : debug # 配置slq打印日志 (方式二) mybatis-plus: configuration: 阅读全文
posted @ 2021-08-12 16:54 甜菜波波 阅读(3493) 评论(0) 推荐(0) 编辑
摘要:一、关系图理解 二、区别 1.过滤器 过滤器是在web应用启动的时候初始化一次, 在web应用停止的时候销毁 可以对请求的URL进行过滤, 对敏感词过滤 挡在拦截器的外层 实现的是 javax.servlet.Filter 接口 ,是 Servlet 规范的一部分 在请求进入容器后,但在进入serv 阅读全文
posted @ 2021-08-10 15:22 甜菜波波 阅读(583) 评论(0) 推荐(0) 编辑
摘要:// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package org.springframework.util; import java 阅读全文
posted @ 2021-07-28 09:42 甜菜波波 阅读(436) 评论(0) 推荐(0) 编辑
摘要:不交付:<plugin> <artifactId>maven-deploy-plugin</artifactId> <configuration> <skip>true</skip> </configuration></plugin> 阅读全文
posted @ 2021-06-25 15:11 甜菜波波 阅读(35) 评论(0) 推荐(0) 编辑
摘要:package com.web.aspect; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.AfterReturning; import 阅读全文
posted @ 2021-06-24 15:35 甜菜波波 阅读(321) 评论(0) 推荐(0) 编辑
摘要:package com..web.advice; import com.web.JsonResult; import lombok.extern.slf4j.Slf4j; import org.springframework.http.HttpStatus; import org.springfra 阅读全文
posted @ 2021-06-24 15:34 甜菜波波 阅读(199) 评论(0) 推荐(0) 编辑
摘要:@NotNull生效的前提必须在类上加了@Validated @Validated 可以加在接口或类上 @NotNull 可以加在定义和实现 方法上(定义和实现方法的@Valid参数必须一致) @NotNull 可以用在Controller和Service上 @Validated :org.spri 阅读全文
posted @ 2021-06-18 13:55 甜菜波波 阅读(1289) 评论(0) 推荐(0) 编辑
摘要:package com.demo.config; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.amqp.core.*; import org.springframework.amqp.r 阅读全文
posted @ 2021-06-11 16:17 甜菜波波 阅读(962) 评论(0) 推荐(0) 编辑
摘要:@ControllerAdvice ,很多初学者可能都没有听说过这个注解,实际上,这是一个非常有用的注解,顾名思义,这是一个增强的 Controller。使用这个 Controller ,可以实现三个方面的功能: 全局异常处理 全局数据绑定 全局数据预处理 灵活使用这三个功能,可以帮助我们简化很多工 阅读全文
posted @ 2021-06-10 15:42 甜菜波波 阅读(464) 评论(0) 推荐(0) 编辑
摘要:sPathResource classPathResource = new ClassPathResource("excleTemplate/test.xlsx");InputStream inputStream =classPathResource.getInputStream();第二种File 阅读全文
posted @ 2021-06-04 17:40 甜菜波波 阅读(1572) 评论(0) 推荐(0) 编辑
摘要:本篇博客我们来自己实现一个类似与其它Spring Boot的starter。最简单的实现吧,不包括任何的业务逻辑。目的是只要引入了我们这个starter,就可以自动配置我们这个项目中的一个Bean(我们的例子中的FooService)。首先肯定是要创建一个Project了,我们直接创建一个Maven 阅读全文
posted @ 2021-06-04 17:12 甜菜波波 阅读(198) 评论(0) 推荐(0) 编辑
摘要:方式一使用注解的方式导入dubbo-starter在application.properties配置属性使用@Service暴露服务使用@Reference引用服务使用@EnableDubbo开启注解Dubbo功能或者配置包扫描dubbo.scan.base-packages=com.atguigu 阅读全文
posted @ 2021-06-04 15:58 甜菜波波 阅读(2448) 评论(0) 推荐(0) 编辑
摘要:以下例子基于Spring Boot 第一步:添加Maven依赖 直接添加以下maven依赖即可 <dependency> <groupId>com.dtflys.forest</groupId> <artifactId>forest-spring-boot-starter</artifactId> 阅读全文
posted @ 2021-05-25 14:08 甜菜波波 阅读(2519) 评论(0) 推荐(0) 编辑
摘要:@Value("${spring.port:8080}")private String port; 阅读全文
posted @ 2021-05-24 18:08 甜菜波波 阅读(913) 评论(0) 推荐(0) 编辑
摘要:https://start.spring.io/ https://blog.csdn.net/ouyang111222/article/details/87862194 阅读全文
posted @ 2021-01-21 20:27 甜菜波波 阅读(212) 评论(0) 推荐(0) 编辑
摘要:有很多应用场景,用到了接口动态实现,下面举几个典型的应用: 1、mybatis / jpa 等orm框架,可以在接口上加注解进行开发,不需要编写实现类,运行时动态产生实现。 2、dubbo等分布式服务框架,消费者只需要引入接口就可以调用远程的实现,分析源代码,其实在消费端产生了接口的代理实现,再由代 阅读全文
posted @ 2021-01-01 09:08 甜菜波波 阅读(1683) 评论(0) 推荐(0) 编辑
摘要:一、SpringBoot中使用Servlet 在SpringBootApplication上使用@ServletComponentScan注解后,Servlet、Filter、Listener可以直接通过@WebServlet、@WebFilter、@WebListener注解自动注册,无需其他代码 阅读全文
posted @ 2020-12-31 17:32 甜菜波波 阅读(626) 评论(0) 推荐(0) 编辑
摘要:在Java应用中,绝大多数情况下都是通过同步的方式来实现交互处理的;但是在处理与第三方系统交互的时候,容易造成响应迟缓的情况,之前大部分都是使用多线程来完成此类任务,其实,在spring 3.x之后,就已经内置了@Async来完美解决这个问题 1. 何为异步调用? 在解释异步调用之前,我们先来看同步 阅读全文
posted @ 2020-07-17 17:30 甜菜波波 阅读(412) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示