1.pom依赖 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4…
1. TaskExecutor Spring异步线程池的接口类,其实质是java.util.concurrent.Executor Spring 已经实现的异常线程池: 1. SimpleAsyncTaskExecutor:不是真的线程池,这个类不重用线程,每次调用都会创建一个新的线程. 2. SyncTaskExecutor:这个类没有实现异步调用,只是一个同步操作.只适用于不需要多线程的地方 3. ConcurrentTaskExecutor:Executor的适配类,不推荐使用.如果Thr…
spring boot 框架整合 thymeleaf spring boot 的官方文档中建议开发者使用模板引擎,避免使用 JSP.因为若一定要使用 JSP 将无法使用. 注意:本文主要参考学习了大神程序员DD的博客. 附上,相应链接:http://blog.didispace.com/springbootweb/ 关于 thymeleaf 模板引擎的介绍 thymeleaf 学习笔记 同时,模板引擎默认的模板配置路径为:src/main/resources/templates. Spring…
一.自定义属性 当我们创建一个springboot项目的时候,系统默认会为我们在src/main/java/resources目录下创建一个application.properties.同时也支持yml格式,可以将application.properties 改成application.yml.以下以yml格式作为配置文件格式my: name: yida age: 18 在java文件中读取配置文件的值只需要加@Value(“${属性名}”)@RestControllerpublic class…
实现 初始化方法和销毁方法3种方式: 实现标识接口 InitializingBean,DisposableBean(不推荐使用,耦合性太高) 设置bean属性 Init-method destroy-method 使用注释配置后,调用@PostConstruct和@PreDestroy注解 注:@PostConstruct和@PreDestroy 标注不属于 Spring,它是在J2EE库- common-annotations.jar. @PostConstruct 和 @PreDestroy…
实现 初始化方法和销毁方法3种方式: 实现标识接口 InitializingBean,DisposableBean(不推荐使用,耦合性太高) 设置bean属性 Init-method destroy-method 使用注释配置后,调用@PostConstruct和@PreDestroy注解   在Spring中,可以使用 init-method 和 destroy-method 在bean 配置文件属性用于在bean初始化和销毁某些动作时.这是用来替代 InitializingBean和Disp…
项目目录树: 1.spring的依赖包配置 * SPRING_HOME/dist/spring.jar * SPRING_HOME/lib/log4j/log4j-1.2.14.jar * SPRING_HOME/lib/jakarta-commons/commons-logging.jar 2.提供spring配置文件applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <be…
Rest (Representational Stat Transer) 是一种软件架构风格. 基础理论 架构特性 性能 可伸缩 简化的统一接口 按需修改 组件通信透明 可移植 可靠性 架构约束 C/S 结构 无状态: Stateless 可缓存 分层系统 按需编码 统一接口: URI , 自描述消息(MIME),超媒体作为应用状态引擎(HATEOAS) WEB MVC MVC 中 URL 与 HTTP 方法的联系 URL 和 HTTP 方法存在联系. 不同方法对应的不同状态, 比如: http…
Spring Cloud Gateway转发Spring WebSocket 源码:https://github.com/naah69/SpringCloud-Gateway-WebSocket-Demo 码云地址:https://gitee.com/liran123/SpringCloud_Gateway_WebSocket_Demo…
Spring Cloud Gateway是什么?(官网地址:https://cloud.spring.io/spring-cloud-gateway/reference/html/) Spring Cloud Gateway是建立在Spring 5, Spring Boot 2 and Project Reactor这几个项目上的API网关,它是由spring团队自己开发的,spring的亲儿子.Spring Cloud Gateway旨在提供一种简单而有效的方法来路由到api,并为它们提供跨领…