![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring
Spring
peacejl
这个作者很懒,什么都没留下…
展开
-
Spring自身提供的一个类DeferredResult(用于作为异步请求的替代方案)
Spring中的DeferredResult设计思想提供了使用可调用异步请求处理的替代方案,可以给一个线程A的结果设置为DeferredResult。之后,在另一个线程B对A线程的该结果进行赋值。主要属性结果超时时间 timeout超时默认结果 timeoutResult超时执行函数 timeoutCallback完成执行函数 completionCallback项目使用DeferredResult的具体场景场景描述:收费员端根据信息,发起收费(在一个平板上显示二维码),患者通过手机原创 2020-10-05 09:49:12 · 553 阅读 · 0 评论 -
利用ApplicationListener接口,监听事件
监听实现大致架构1、根据监听的事件,嗅探出有哪些对该事件的监听器(类)。保存起来;2、当事件发生事,通知该监听器,执行操作@FunctionalInterfacepublic interface ApplicationListener<E extends ApplicationEvent> extends EventListener { /** * Handle an application event. * @param event the event to respond原创 2020-10-05 02:21:02 · 364 阅读 · 0 评论 -
Spring--自定义拦截器
自定义拦截器想要自定义一个拦截器时,可以继承Spring提供的HandlerInterceptorAdapter。该抽象类,有4个方法可以覆盖。一般拦截器,需要覆盖,preHandle、postHandle是什么HandlerInterceptorAdapter:一个Spring提供的拦截器抽象类。在需要自定义拦截器时使用。是一个抽象类,类中有4个方法可以进行重写。把具体实现类配置到MVCCONFIG的拦截器后,SpringMVC框架会在http请求进入时,启用该拦截器。处理程序拦截器在处理原创 2020-09-11 09:22:28 · 152 阅读 · 0 评论 -
@import
@Import注解通过导入的方式实现把实例加入springIOC容器中原创 2020-05-07 09:29:53 · 123 阅读 · 0 评论 -
@Value
@Value不通过配置文件的注入属性的情况通过@Value将外部的值动态注入到Bean中,使用的情况有:注入普通字符串注入操作系统属性注入表达式结果注入其他Bean属性:注入beanInject对象的属性another注入文件资源注入URL资源通过配置文件的注入属性的情况通过@Value将外部配置文件的值动态注入到Bean中。配置文件主要有两类:...原创 2020-04-28 10:11:40 · 119 阅读 · 0 评论 -
Spring官方文档学习时一些标注、摘抄
2020.04.06-SpringFramework官方文档-IOC容器1.1-1.5该org.springframework.context.ApplicationContext接口代表Spring IoC容器,并负责实例化,配置和组装Bean实际上,您的应用程序代码应该根本不调用该 getBean()方法Bean行为配置元素,用于声明Bean在容器中的行为(作用域,生命周期回调等)。池...原创 2020-04-22 11:46:12 · 127 阅读 · 0 评论 -
关于@configuration @bean
**@configuration **@Configuation等价于@Bean@Bean明确地指示了一种方法,什么方法呢——产生一个bean的方法,并且交给Spring容器管理@Bean等价于原创 2020-04-21 23:02:09 · 110 阅读 · 0 评论 -
springboot中的一些跳转问题
1.SpringBoot默认解析文件类型为ftl的文件;2.Springboot中不添加thymeleaf会报错, No message available(可能是后缀名不对,无法解析)3.在控制器中,如:请求路径和返回值一致时,会陷入死循环,如:///@Controller public class getcontroller { @RequestMapping("/login1")...原创 2019-08-21 10:28:02 · 790 阅读 · 0 评论 -
spring-boot-maven-plugin的作用
Spring Boot Maven plugin能够将Spring Boot应用打包为可执行的jar或war文件,如为web项目,则不需要再建立一个tomcat就能直接运行该程序,方便部署;原创 2020-03-03 11:30:02 · 1723 阅读 · 0 评论 -
配置springboot解决前端跨域问题
前端先获取页面,后用请求后台数据时,容易出现跨域问题,配置springboot可以解决,import org.springframework.context.annotation.Configuration;import org.springframework.web.servlet.config.annotation.CorsRegistry;import org.springframe...原创 2020-02-10 12:36:00 · 299 阅读 · 0 评论 -
在不配置数据库的情况下,如何启动springboot
1.使用注解:@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})如:@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})public class IhplWcasApplication { public stati...原创 2020-02-08 18:27:07 · 805 阅读 · 0 评论 -
关于Spring
对类进行@compont注解后,就能自动注入。在其他类中可使用下列语句获得实例@AutowiredGlobalProperties globalProperties;原创 2020-03-23 10:08:40 · 185 阅读 · 0 评论 -
WebMvcConfigurer和WebMvcConfigurationSupport配置拦截器时
一、用WebMvcConfigurer实现WebMvcConfigurer是一个接口实现之后,配置 @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new VerifyHandlerInterceptor()).addPathPatterns("/...原创 2019-09-17 14:13:58 · 2964 阅读 · 0 评论 -
HandlerInterceptorAdapter
HandlerInterceptorAdapter是什么?HandlerInterceptorAdapter是Spring框架提供的一个适配器,通过继承它可以很方便的实现一个拦截器;HandlerInterceptorAdapter怎么用?它有三个方法:public boolean preHandle(HttpServletRequest request, HttpServletRespo...原创 2019-09-12 17:44:25 · 543 阅读 · 1 评论 -
spring相关知识整理
Spring是一个基于IOC和AOP的结构J2EE系统的框架IOC 反转控制 是Spring的基础,Inversion Of Control控制反转的技术描述:简单说就是创建对象由以前的程序员自己new 构造方法来调用,变成了交由Spring创建对象Class A中用到了Class B的对象b,一般情况下,需要在A的代码中显式的new一个B的对象。采用依赖注入技术之后,A的代码只需要定义...原创 2019-04-07 15:23:27 · 143 阅读 · 0 评论