Loading

摘要: bean.xml中配置依赖 1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:xsi="http://www.w3.org/200 阅读全文
posted @ 2019-09-12 23:33 小飞猪咯咯 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 理解依赖注入:参考https://blog.csdn.net/taijianyu/article/details/2338311 一、依赖注入让bean与bean之间以配置文件组织在一起,而不是以硬编码的方式耦合在一起。 二、依赖注入(Dependency Injection)和控制反转(Inver 阅读全文
posted @ 2019-09-12 17:43 小飞猪咯咯 阅读(379) 评论(0) 推荐(0) 编辑
摘要: bean的作用范围调整: 1 <!--bean的作用范围调整 2 bean标签的scope属性: 3 作用:用于指定bean的作用范围 4 取值:常用的就是单例的和多例的 5 singleton:单例的(默认值) 6 prototype:多例的 7 request:作用于web应用的请求范围 8 s 阅读全文
posted @ 2019-09-12 14:30 小飞猪咯咯 阅读(606) 评论(1) 推荐(2) 编辑
摘要: <!--创建Bean的三种方式--><!--第一种方式,使用默认构造函数创建 在spring的配置文件中使用bean标签,配以id和class属性之后,且没有属性和标签时。 采用的就是默认构造函数创建bean对象,此时如果类没有默认构造函数,则对象无法创建--> <bean id="accountS 阅读全文
posted @ 2019-09-12 13:51 小飞猪咯咯 阅读(1482) 评论(0) 推荐(0) 编辑
摘要: * ApplicationContest的三个常用实现类* ClassPathXmlApplicationContext:它可以加载类路径的配置文件,要求配置文件必须在类路径下,如果不在则加载不了* FileSystemXmlApplicationContext:它可以加载磁盘任意路径下的配置文件( 阅读全文
posted @ 2019-09-12 13:48 小飞猪咯咯 阅读(1896) 评论(0) 推荐(0) 编辑
摘要: 配置pom.xml的依赖 <packaging>jar</packaging> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <ve 阅读全文
posted @ 2019-09-12 11:59 小飞猪咯咯 阅读(300) 评论(0) 推荐(0) 编辑
摘要: 在resources下创建bean.properties accountService=cn.flypig666.service.impl.AccountServiceImpl accountDao=cn.flypig666.dao.impl.AccountDaoImpl 创建工厂:BeanFact 阅读全文
posted @ 2019-09-12 11:26 小飞猪咯咯 阅读(869) 评论(0) 推荐(0) 编辑
摘要: 分别在创建项目时填入以下值: Name:archetypeCatalogValue:internal idea常用的快捷键 Alt+回车 导入包,自动修正 Ctrl+N 查找类 Ctrl+Shift+N 查找文件 Ctrl+Alt+L 格式化代码 Ctrl+Alt+O 优化导入的类和包 Alt+In 阅读全文
posted @ 2019-09-12 10:52 小飞猪咯咯 阅读(549) 评论(0) 推荐(0) 编辑