摘要: Springboot的运行流程 1、判断是否是web环境 2、加载左右Classpath下的META-INF/spring.factories ApplicationContextInitializer 3、加载所有classpath下的META-INF/spring.factories Appli 阅读全文
posted @ 2018-07-26 10:06 637 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 事件监听 方法一: //新建事件监听器。 实现ApplicationListener接口 import org.springframework.context.ApplicationListener; public class MyApplicationListener implements App 阅读全文
posted @ 2018-07-25 10:28 637 阅读(92) 评论(0) 推荐(0) 编辑
摘要: @EnableAutoConfiguration自动配置 其内部实现的关键点有 1、importselector该接口的方法返回值会被纳入到Spring容器中 2、SpringFactoriesloader可以从classpath中接收META-INF下的Spring.factories的配置文件 阅读全文
posted @ 2018-07-23 15:32 637 阅读(87) 评论(0) 推荐(0) 编辑
摘要: @Enable注解原理(视频09) 4个 使用@import()将Javabean导入Spring容器中 @SpringBootApplication @ComponentScan @Async//异步处理。bean 类之上 //@EnableAsync使异步处理生效 //@Import({User 阅读全文
posted @ 2018-07-23 13:00 637 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Condition自动配置 @Conditional配合condition接口使用,只有借口的实现类返回true,才会装配 使用在方法上只对方法有效,使用在类上,对类所有方法有效 也可以传多个参数,表示这些参数都返回true才会装配 @SpringBootConfiguration public c 阅读全文
posted @ 2018-07-23 01:57 637 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 控制profile生效的两种方式 @SpringBootApplication public class App { public static void main(String[] args) { //使用默认profile ConfigurableApplicationContext conte 阅读全文
posted @ 2018-07-22 14:09 637 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 获取配置文件的三种方式 默认配置文件名application.properties application.yml @SpringBootApplication public class App { public static void main(String[] args) { Configura 阅读全文
posted @ 2018-07-20 18:04 637 阅读(112) 评论(0) 推荐(0) 编辑
摘要: springboot 快速入门 Springboot的环境搭建 1、继承 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version 阅读全文
posted @ 2018-07-20 11:25 637 阅读(114) 评论(0) 推荐(0) 编辑
摘要: pring 几个扩展点 ___________________________BeanPostProcesser___________________________ bean初始化时触发 在bean依赖装配(设置完成后)完成触发 这里可以指定Bean做一些处理,比如返回该对象的代理对象 @Comp 阅读全文
posted @ 2018-07-19 16:21 637 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 三种ApplicationContext依赖注入的方式 1、注解 @Component public class User { @Autowired private ApplicationContext applicationContext; public void show() { System. 阅读全文
posted @ 2018-07-19 14:41 637 阅读(80) 评论(0) 推荐(0) 编辑