
SpringBoot
springboot整合案例
ITdfq
夏虫不可语冰,井蛙不可语海
展开
-
解决SpringBoot定时任务并发执行线程单例问题
测试代码package com.itdfq.springbootscheduled;import org.springframework.scheduling.annotation.Scheduled;import org.springframework.stereotype.Component;import java.time.LocalDateTime;import java.util.concurrent.TimeUnit;/** * @Author: GodChin * @D原创 2021-08-13 10:21:49 · 770 阅读 · 0 评论 -
SpringBoot自带优雅关闭
官方介绍Spring Boot 2.3.0 available nowGraceful shutdownGraceful shutdown is supported with all four embedded web servers (Jetty, Reactor Netty, Tomcat, and Undertow) and with both reactive and Servlet-based web applications. When a grace period is configur原创 2021-08-04 11:01:48 · 260 阅读 · 0 评论 -
SpringBoot+Dubbo+Zookeeper入门案例
项目功能生产者提供服务(售卖票)消费者消费服务(买票)项目搭建创建两个模块,分别代表生产者和消费者生产者pom文件 <!-- Dubbo Spring Boot Starter --> <dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo-spring-boot-starter&l原创 2021-06-19 17:38:17 · 148 阅读 · 0 评论 -
SpringBoot异步任务和定时任务
异步任务在启动类中开启异步任务功能@EnableAsync@SpringBootApplicationpublic class SpringbootTestApplication { public static void main(String[] args) { SpringApplication.run(SpringbootTestApplication.class, args); }}在需要异步的方法上添加@Async注解 @Async p原创 2021-06-09 13:53:03 · 134 阅读 · 0 评论 -
SpringBoot原生发送邮件
引入依赖<!-- mail--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency>配置信息spring: mail: u原创 2021-06-09 13:32:29 · 91 阅读 · 0 评论 -
SpringBoot集成Shiro
Shiro 简介官方介绍Apache Shiro™ is a powerful and easy-to-use Java security framework that performs authentication, authorization, cryptography, and session management. With Shiro’s easy-to-understand API, you can quickly and easily secure any application –原创 2021-06-06 18:51:43 · 93 阅读 · 4 评论 -
SpringBoot静态资源
webjars可以将静态的资源通过jar包放进项目中通过设置maven坐标,可以直接将静态资源导入到项目中resources目录下拥有四个文件夹public :优先级最低(公共文件)resources :优先级最高(一般放置上传文件)static :优先级第二(静态资源,图片等等)默认使用staticwebjars :这一个已经被识别为/webjars/** 可以通过localhost:8080/webjars/ 进行访问SpringBoot静态资源访原创 2021-06-05 19:34:50 · 112 阅读 · 0 评论 -
SpringBoot配置介绍
配置文件优先级官网文档说明解释优先级1:项目路径下的config文件夹配置文件优先级2:项目路径下配置文件优先级3:资源路径下的config文件夹配置文件优先级4:资源路径下配置文件多环境配置application.properties配置多环境下的配置文件-切换配置环境spring.profiles.active= dev注意 :只需要写-后面的即可yml配置yml配置不需要创建那么多的配置文件,只需要一个就可以,可以在一个配置文件中定义多个环境;每原创 2021-06-05 17:30:28 · 69 阅读 · 0 评论 -
yaml语法
什么是yamlYAML(/ˈjæməl/,尾音类似camel骆驼)是一个可读性高,用来表达数据序列化的格式。YAML参考了其他多种语言,包括:C语言、Python、Perl,并从XML、电子邮件的数据格式(RFC 2822)中获得灵感。Clark Evans在2001年首次发表了这种语言,另外Ingy döt Net与Oren Ben-Kiki也是这语言的共同设计者。当前已经有数种编程语言或脚本语言支持(或者说解析)这种语言。SpringBoot中用于配置文件springboot中常用yml 和ya原创 2021-06-05 15:47:24 · 115 阅读 · 0 评论 -
SpringBoot整合redis(源码)
依赖 <!-- redis --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <!-- spring2.X.原创 2021-05-06 13:23:58 · 299 阅读 · 1 评论 -
SpringBoot整合RabbitMQ(源代码)
SpringBoot整合RabbitMQ1. 配置类:服务器配置、创建交换器、创建队列、创建绑定关系2. 生产者:使用路由键发送消息(使用template)3. 消费者:监听类(监听队列) 推模式交换器有三种分别为 direct fanout topicdirect传递的为Key=“red”fanout是广播,不考虑key全部发送topic绑定的类型为red.* 可以接受red.任意值 小数点代码分隔符 red.82 就只能接受red.82配置类package c原创 2021-05-02 00:21:47 · 337 阅读 · 1 评论 -
Docker安装Minio存储服务器
拉取镜像的命令docker pull minio/minio自定义安装 docker run -p 9000:9000 --name minio -d --restart=always -e "MINIO_ACCESS_KEY=root" -e "MINIO_SECRET_KEY=root" -v /home/data:/data -v /home/config:/root/.minio minio/minio server /data查看安装logs信息docker logs ea407f6原创 2021-04-17 20:49:53 · 166 阅读 · 0 评论 -
SpringBoot配置
<!--热部署配置--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId></dependency>原创 2020-04-23 15:30:11 · 113 阅读 · 0 评论