avatar
文章
84
标签
36
分类
29
主页
归档
标签
分类
关于我
flyingzc's blog
主页
归档
标签
分类
关于我

flyingzc's blog

springboot conditional 注解
发表于2020-07-01|spring-boot
@Conditional满足指定条件的时候才将某个 bean 加载到应用上下文中. 比如 FreemarkerAutoConfiguration 这个自动化配置类的定义如下: 1234567@ConditionalOnClass(ThreadPoolTaskScheduler.class)@Configuration@EnableConfigurationProperties(TaskSchedulingProperties.class)@AutoConfigureAfter(TaskExecutionAutoConfiguration.class)public class TaskSchedulingAutoConfiguration { // ...} 这个自动化配置类被 @ConditionalOnClass 条件注解修饰, 这个条件注解存在的意义在于判断类加载器中是否存在 ThreadPoolTaskScheduler 这个类, 如果存在的话会在 Spring 容器中加载这个 TaskSchedulingAutoConfiguration...
spring-boot EnableAutoConfiguration
发表于2020-06-14|springboot
spring-boot EnableAutoConfiguration1234567891011121314151617181920212223242526272829- refresh() -> invokeBeanFactoryPostProcessors()- ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry() - ConfigurationClassPostProcessor.processConfigBeanDefinitions() - 1.parser.parse(candidates)比如此时candidates是SpringApplication启动类 - ConfigurationClassParser.parse() - 1.不同类型的 beanDefinition,调用不同的 parse(),parse()方法 -> processConfigurationClass() -...
Spring ConfigurationClassParser
发表于2020-06-13|Spring
Spring ConfigurationClassParser123456789101112131415161718192021- ConfigurationClassPostProcessor.processConfigBeanDefinitions()- 1.获取 registry 中的 beanDefinitionNames- 2.遍历beanDefinitionNames判断beanDefinition 是否是 @Configuration 配置类,若是则添加到 configCandidates 集合中- 3.configCandidates根据Order排序- 4.创建ConfigurationClassParser,配置类解析器- 5.遍历configCandidates,调用parser.parse()进行配置类解析 - ConfigurationClassParser.parse() - 1.遍历configCandidates,获取当前的beanDefinition -...
Spring component-scan实现
发表于2020-06-06|spring
componet-scan分为 xml 配置 和 注解配置两种方式,二者入口不同,实现上没太多差别.都是先解析配置,根据配置的 basePackages 用asm扫描.class上是否有@Component注解,若有则生成beanName,注册到容器里即可. context:component-scan/实现配置1<context:component-scan base-package="com.zc"/> 切入点对于自定义标签的解析入口在 DefaultBeanDefinitionDocumentReader.parseCustomElement(ele); 里.1.先根据标签获取parser,这里是 ComponentScanBeanDefinitionParser 调用12345678910111213141516171819202122- NamespaceHandlerSupport.parse(): 根据元素获取parser进行处理,这里使用的是ComponentScanBeanDefinitionParser -...
spring-boot启动流程
发表于2020-05-24|springboot
spring-boot 启动 spingboot-start SpringApplication构造方法 使用 SpringFactoriesLoader 在 classpath 中查找并加载所有可用的 ApplicationContextInitializer 使用 SpringFactoriesLoader 在 classpath 中查找并加载所有可用的 ApplicationListener 通过stackTrace里的main方法查找启动类 SpringApplication.run() 创建StopWatch计时器 通过 SpringFactoriesLoader 查找并加载 SpringApplicationRunListener 列表,调用 SpringApplicationRunListener.started() 方法 创建Environment configureEnvironment() listeners.environmentPrepared(): 广播 ApplicationEnvironmentPreparedEvent...
idea搭建spring-boot环境
发表于2020-05-19|springboot
idea搭建spring-boot环境显示taggit tag 选择 v2.1.5.RELEASE 版本,这是我们项目里现在在用的版本,还比较新,最新的目前是 2.3.0. 拉自己的分支 建立我自己的分支,以后代码注释都写在这个分支上.v2.1.5.RELEASE-zc git checkout -b v2.1.5.RELEASE-zc v2.1.5.RELEASE v2.1.5.RELEASE 这个版本是可以选择 maven 或 gradle 构建的,我这里选的maven. 工程依赖的jar包很多,大概要下个半小时多. 将本地分支推到远程git push origin v2.1.5.RELEASE-zc 建立关联git push –set-upstream origin v2.1.5.RELEASE-zc 看看代码量spring-boot 总共代码45w行,纯代码 27w 行. idea attach sourceidea 的配置最终都落到 .idea 下的 xml 里,搜索 springboot 的 maven 配置文件,修改里面的...
Tomcat处理请求流程
发表于2019-12-26|Tomcat
tomcat处理请求组件Server123456789101112131415Server|-- Service|--|-- Connector|--|--|-- Prototal|--|--|--|-- Endpoint|--|--|--|--|-- Acceptor|--|--|--|--|-- Executor|--|--|--|-- Processor|--|--|-- Mapper|--|--|-- CoyteAdapter|--|-- Container|--|--|--|-- Host|--|--|--|-- Context|--|--|--|-- Wrapper|--|-- Executor Http11NioProtocol12345678910111213Http11NioProtocol|-- NioEndpoint|--|-- LimitLatch|--|-- Acceptor|--|-- Poller|--|-- Poller池|--|-- SocketProcessor|--|-- Executor|--|-- PollerEvent|--|--...
Tomcat Session机制
发表于2019-12-20|Tomcat
tomcat session相关类12345org.apache.catalina.ManagerStandardManagerSessionIdGenerator Manager实现类Manager 用于管理 session.默认实现是 StandardManager,基类 ManagerBase. 123456789101112Manager ClusterManager (org.apache.catalina.ha) ClusterManagerBase (org.apache.catalina.ha.session) BackupManager (org.apache.catalina.ha.session) DeltaManager (org.apache.catalina.ha.session) ManagerBase (org.apache.catalina.session) PersistentManagerBase (org.apache.catalina.session)...
Tomcat实现分布式session
发表于2019-12-20|Tomcat
tomcat实现分布式sessiontomcat-redis-session-manager 使用Copy the following files into the TOMCAT_BASE/lib directory: 123tomcat-redis-session-manager-VERSION.jarjedis-2.5.2.jarcommons-pool2-2.2.jar 配置 TOMCAT_HOME/conf/context.xml 12345<Valve className="com.radiadesign.catalina.session.RedisSessionHandlerValve" /><Manager className="com.radiadesign.catalina.session.RedisSessionManager" host="localhost" port="6379"...
Tomcat Lifecycle
发表于2019-12-19|Tomcat
LifeCycleLifeCycle 相关类LifeCycle 接口中的状态扭转注释,如下: 12345678910111213141516171819202122232425262728* start()* -----------------------------* | |* | init() |* NEW -»-- INITIALIZING |* | | | | ------------------«-----------------------* | | |auto | | |* | | \|/ start() \|/ \|/ auto auto stop() |* | | ...
1…567…9
avatar
flyingzc
不积跬步无以至千里
不积小流无以成江海
文章
84
标签
36
分类
29
Follow Me
公告
FlyingZC's Blog
最新文章
Apache Ignite 开启事务执行流程2025-10-11
Apache Ignite 分布式事务原理2025-09-18
Apache Ignite IDEA 环境搭建2025-09-11
ShardingSphere JDBC 使用 Druid 连接池 ResultSet 内存泄露分析2025-07-01
Jmeter 压测 ShardingSphere2025-07-01
分类
  • ADB1
  • AI1
  • Concurrent2
  • Coral2
  • Data Structure1
  • Docker1
  • Druid1
  • Dubbo7
标签
MySQL spring Redis Druid Termux H2 Ignite Omid Ubuntu Desktop ShardingSphere Dubbo Otter git Ubuntu Coral Hotspot Docker Concurrent SQL-Parse Spring Zookeeper SpringBoot Maven Linux Tool Database Data Structure Tomcat Paddle ADB springboot Android Jmeter Transaction Narayana Percolator
归档
  • 十月 2025 1
  • 九月 2025 2
  • 七月 2025 3
  • 四月 2025 1
  • 三月 2025 1
  • 十一月 2024 1
  • 十月 2024 4
  • 九月 2024 2
网站信息
文章数目 :
84
本站访客数 :
本站总浏览量 :
最后更新时间 :
©2020 - 2025 By flyingzc