springboot
文章平均质量分 85
zhuhaoyu6666
热爱编程、热爱生活、喜欢挑战
展开
-
springboot启动过程中常用的回调
springboot启动过程中常用的回调常用的回调接口ApplicationContextInitializer ApplicationListener ApplicationRunner CommandLineRunner示例ApplicationContextInitializer接口是在spring容器初初始化之前调用的自定义spring容器启动前需要处理的业务逻辑importorg.springframework.context.ApplicationContextInit.原创 2022-01-10 22:00:00 · 272 阅读 · 0 评论 -
@Scheduler&@Async的优化
import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org..原创 2021-04-06 15:32:18 · 294 阅读 · 1 评论 -
002Springboot加载properties文件的3种方式
第1种 使用@Value("${属性key}")第2种 使用 @PropertySource(prefix = "属性的前缀")第3种使用@PropertySources+@PropertySource第1种import lombok.Data;import org.springframework.beans.factory.annotation.Value;import org.springframework.stereotype.Component;@Component@D...原创 2020-06-18 17:58:18 · 1374 阅读 · 0 评论 -
springboot 新的日志规则
##日志logging.level.root=info#在父项目下,新建一个目录(名为logs)#logging.file=logs/${spring.application.name}.log #已经过时了# logging.file.path 与logging.file.name 只能使用一个#就会在根项目下logs/spring.log 记录日志#logging.file.pa...原创 2020-03-05 23:32:43 · 274 阅读 · 0 评论 -
Springboot2 Druid的配置
#Mybatis的配置#日志 让控制台打印sql语句logging.level.com.allen.druid.dao=debug#通过包扫描自定义别名,相等于mybatis的<typeAliases>的子标签<package name=com.allen.springbootmybatis.bean>#特别注意指定的包目录下,不能有重名的类,因为它是把类名首字...原创 2020-02-07 23:38:16 · 4835 阅读 · 1 评论 -
springboot2 mybatis的配置
#日志 让控制台打印sql语句logging.level.com.allen.springbootmybatis.dao=debug#通过包扫描自定义别名,相等于mybatis的<typeAliases>的子标签<package name=com.allen.springbootmybatis.bean>#特别注意指定的包目录下,不能有重名的类,因为它是把类名首字...原创 2020-02-07 16:22:02 · 922 阅读 · 0 评论 -
详解springboot约定大于配置即自动配置的面纱
以整合Thymeleaf模板为例子:在spring自动配置的jar包种即spring-boot-autoconfigure-2.2.3.RELEASE.jar中有一个自动配置类ThymeleafAutoConfiguration。此类的作用:@Configuration(proxyBeanMethods = false)归spring管理并不使用动态代理 @EnableConf...原创 2020-01-20 11:55:43 · 579 阅读 · 0 评论 -
springboot-websocket
1. 依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId></dependency>2. 配置import org.sp...原创 2020-01-06 22:30:33 · 121 阅读 · 0 评论 -
WebMvcConfigurer 详解
下载地址:https://download.csdn.net/download/zhuhaoyu6666/12066064package org.springframework.web.servlet.config.annotation;import java.util.List;import org.springframework.format.FormatterRegistry;...原创 2019-12-30 17:11:26 · 5865 阅读 · 1 评论 -
springboot2.x整合jsp
一、依赖<!--jsp页面使用jstl标签 --><dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId></dependency><!--用于编译jsp --><d...原创 2019-12-18 15:58:06 · 561 阅读 · 0 评论