springboot
zenofung
这个作者很懒,什么都没留下…
展开
-
springboot 监听器
1系统监听器和过滤器差不多就不详细说了类 ListenerConfig@Configurationpublic class ListenerConfig { @Bean public EventListener demoListener(){ return new DemoListener(); } @Bean public ServletListenerRegistrationBean servletListenerRegistrati原创 2021-04-24 11:48:40 · 350 阅读 · 3 评论 -
springboot 过滤器
两种方式 一种注解方式,一种配置类方式。配置类FilterConfig/** * 两种方式 * 第一种注解,启动类加上 * @ServletComponentScan(basePackages = "com.fpcs.top.springbootconformity.filter") * 然后在自定义的Filter添加注解 * @WebFilter(urlPatterns = "/*",filterName = "demoFilter") * * 第二种就是添加配置类,装在自定义bean原创 2021-04-24 10:18:42 · 129 阅读 · 1 评论 -
springboot 整合redis 键失效监听器
// An highlighted block/** * redis配置 * * @author ruoyi */@Configuration@EnableCachingpublic class RedisConfig extends CachingConfigurerSupport { @Autowired private RedisConnectionFactory redisConnectionFactory; @Bean @SuppressWarn原创 2021-04-22 18:04:40 · 135 阅读 · 0 评论 -
springboot切面技术打印log日志。
springboot切面技术打印log日志。项目的部分功能需要新增加日志的操作记录,想了一圈还是使用切面技术比较方便解决。 相当于代理,感觉比代理更牛逼。说一下关键词 自己理解的。@Aspect 把当前类搞成一个切面类,提供容器读取@Pointcut:定义切点,扫描那个包下面的那个类,具体到那个方法。@Around:环绕增强,相当于MethodInterceptor@AfterReturning:后置增强,相当于AfterReturningAdvice,方法正常退出时执行@Before:原创 2021-04-21 18:10:17 · 652 阅读 · 1 评论