随笔分类 -  Spring

摘要:Spring 5.x版本 001、依赖包 Spring的各包之间相互依赖,导入这一个包就可以包Spring的基本几个包同时引入。 <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artif 阅读全文
posted @ 2020-12-28 10:00 cgl_dong 阅读(53) 评论(0) 推荐(0) 编辑
摘要:1、@PropertiesSource注解 这是Spring中的注解,用于读取属性文件,默认读取classpath下的文件。 如在classpath路径下的a.properties中: desc="is a property" 通过Value注解可以去到属性: @Component @Propert 阅读全文
posted @ 2020-10-20 09:52 cgl_dong 阅读(551) 评论(0) 推荐(0) 编辑
摘要:Spring中的事件机制 Spring对事件机制也提供了支持,一个事件被发布后,被对应的监听器监听到,执行对应方法。 Spring内已经提供了许多事件,ApplicationEvent可以说是Spring事件的顶级父类。 ApplicationListener 是监听器的顶级接口,事件被触发后,on 阅读全文
posted @ 2020-10-20 09:51 cgl_dong 阅读(72) 评论(0) 推荐(0) 编辑
摘要:Spring后置处理器BeanPostProcessor Spring提供了许多扩展点,如FactoryBean、Aware,这里还有BeanPostProcessor 在Spring的生命周期中,BeanPostProcessor在初始化前后处理bean。 Spring中的bean每个都会经过Be 阅读全文
posted @ 2020-10-20 09:49 cgl_dong 阅读(71) 评论(0) 推荐(0) 编辑
摘要:SpringData Jpa笔记 一、简介 Spring data JPA是Spring在ORM框架,以及JPA规范的基础上,封装的一套JPA应用框架,并提供了一整套的数据访问层解决方案。 Spring data JPA提供给用户的主要有以下几个接口: Repository: 仅仅是一个标识,表明任 阅读全文
posted @ 2020-07-28 15:06 cgl_dong 阅读(169) 评论(0) 推荐(0) 编辑
摘要:Spring中如何注册bean和获取bean Spring5.x发布了,再次复习一下常用的注册和获取bean的方法。 1.基于xml配置注册于获取bean 2.半注解半xml方式 3.基于注解注册与获取bean 常用于获取bean的类: ClassPathXmlApplicationContext、 阅读全文
posted @ 2020-01-06 18:04 cgl_dong 阅读(1854) 评论(0) 推荐(0) 编辑
摘要:Spring之ResourceLoader Spring中的ResourceLoader用于加载资源。可以从文件中、网络中、流中加载资源。 资源加载器是个接口,默认从类路径下加载。通过getResource方法从字符串中查找路径。可以从容器中获取ResourceLoader,调用getResourc 阅读全文
posted @ 2020-01-05 20:18 cgl_dong 阅读(559) 评论(0) 推荐(0) 编辑
摘要:Spring之Environment Spring在运行时的环境有多个选择,开发环境、测试环境、生产环境等。每个Environment中可以配置多个Property,这些Property可以自定义配置,配置信息可以注入Spring容器。 这种配置可以在xml中,也可以在javaConfig中。 我们 阅读全文
posted @ 2020-01-05 20:06 cgl_dong 阅读(1312) 评论(0) 推荐(0) 编辑
摘要:​ Spring之Aware ​ Spring 中的Aware用于帮助bean获取Spring Bean获取Spring容器的功能。 如这些Aware: ApplicationContextAware//获取容器服务 BeanNameAware//获取BeanName ResourceLoaderA 阅读全文
posted @ 2020-01-05 20:04 cgl_dong 阅读(286) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示
🚀
回顶
收起
  1. 1 404 not found REOL
404 not found - REOL
00:00 / 00:00
An audio error has occurred.