随笔分类 -  Spring

摘要:@EnableAspectJAutoProxy @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @Documented @Import(AspectJAutoProxyRegistrar.class) public @int 阅读全文
posted @ 2020-02-02 16:12 BINGJJFLY 阅读(181) 评论(0) 推荐(0)
摘要:步骤 创建xxxAutoConfiguration类 添加@Configuration注解修饰 添加@Conditionalxxx注解做注入条件判断 添加@AutoConfigureOrder注解注入顺序 添加@AutoConfigureAfter注解注入后操作 创建xxxProperties配置类 阅读全文
posted @ 2019-12-14 18:31 BINGJJFLY 阅读(241) 评论(0) 推荐(0)
摘要:主配置类 @SpringBootApplication public class SpringBootDruidApplication { public static void main(String[] args) { SpringApplication.run(SpringBootAutoCon 阅读全文
posted @ 2019-12-13 15:37 BINGJJFLY 阅读(185) 评论(0) 推荐(0)
摘要:主类Main方法 public static void main(String[] args) { SpringApplication.run(SpringBootRunApplication.class, args); } 创建SpringApplication对象 public static C 阅读全文
posted @ 2019-12-13 12:48 BINGJJFLY 阅读(981) 评论(0) 推荐(0)
摘要:WebServerFactory自动配置 @Configuration @AutoConfigureOrder(-2147483648) @ConditionalOnClass({ServletRequest.class}) @ConditionalOnWebApplication( type = 阅读全文
posted @ 2019-11-17 20:36 BINGJJFLY 阅读(334) 评论(0) 推荐(0)
摘要:Ⅰ. SpringApplication 1. Startup Failure 启动失败 注入FailureAnalyzers 获得一个机会去提供一个详细的错误信息 SpringBoot提供了很多FailureAnalyzer 的实现类,也可以添加自定义的 如果没有failure analyzers 阅读全文
posted @ 2019-09-15 17:29 BINGJJFLY 阅读(1030) 评论(0) 推荐(0)
摘要:或者带默认值 或者默认值是某个类的静态变量 阅读全文
posted @ 2018-05-18 15:03 BINGJJFLY 阅读(1107) 评论(0) 推荐(0)
摘要:BeanPostProcessor接口的行为方法 自定义的BeanPostProcessor 自定义的修改 关于Shiro框架对于BeanPostProcessor的使用 LifecycleBeanPostProcessor AuthenticatingRealm 阅读全文
posted @ 2018-05-18 11:39 BINGJJFLY 阅读(426) 评论(0) 推荐(0)
摘要:参考:http://blog.csdn.net/mhmyqn/article/details/47342577 阅读全文
posted @ 2017-10-11 16:34 BINGJJFLY 阅读(332) 评论(0) 推荐(0)
摘要:web.xml配置文件 ContextLoaderListener上下文加载监听器 创建spring容器 书接前文#1 书接前文#2 接下来是销毁spring容器 阅读全文
posted @ 2017-09-22 14:26 BINGJJFLY 阅读(985) 评论(0) 推荐(0)
摘要:前提是: 其他的配置文件中已经配置了<context:property-placeholder location="classpath:jdbc.properties"/> 主要原因是: Spring容器采用反射扫描的发现机制,在探测到Spring容器中有一个org.springframework. 阅读全文
posted @ 2017-09-20 10:43 BINGJJFLY 阅读(1324) 评论(0) 推荐(0)
摘要:切面类 xml文件配置 命名空间处理器是AopNamespaceHandler,我们可以看到这里注册了几个解析器,第一个我们知道是xml形式的解析,接下来我们看AspectJAutoProxyBeanDefinitionParser解析器 <aop:aspectj-autoproxy/>标签注册了A 阅读全文
posted @ 2017-09-11 13:28 BINGJJFLY 阅读(797) 评论(0) 推荐(0)
摘要:我可以看到初始化了一个任务线程延迟调度器ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();注入到了Runnable中 核心类MyRunnable实现了Runnable和ScheduledF 阅读全文
posted @ 2017-09-08 15:56 BINGJJFLY 阅读(1428) 评论(0) 推荐(0)
摘要:spring配置文件中配置 定时任务处理类 <task:annotation-driven/>标签使用TaskNamespaceHandler 来处理 注册了两个后置处理器 org.springframework.scheduling.annotation.AsyncAnnotationBeanPo 阅读全文
posted @ 2017-09-06 16:37 BINGJJFLY 阅读(24437) 评论(0) 推荐(1)
摘要:核心思想 aop的核心思想是目标对象初始化后创建其代理对象(cglib、jdk)。代理对象执行方法时走MethodInterceptor的invoke拦截方法,实现横切。 实现原理 首先我们先来看AspectJAwareAdvisorAutoProxyCreator(还有AnnotationAwar 阅读全文
posted @ 2017-08-30 17:27 BINGJJFLY 阅读(916) 评论(0) 推荐(0)
摘要:<aop:config>标签解析 aop名称空间的解析器是AopNamespaceHandler // 这里我们可以看到注册了几个解析器,重点关注ConfigBeanDefinitionParser 在ConfigBeanDefinitionParser的parse方法中对aop:config下面的 阅读全文
posted @ 2017-08-30 13:37 BINGJJFLY 阅读(1216) 评论(0) 推荐(0)