摘要: @Conditional进行条件判断: 符合条件则加载该bean,不符合则不加载该bean 示例1、用于测试的bean实体 package com.bean;/** * @auto dh * @create 2020-04-25-15:10 */public class Animal {} pack 阅读全文
posted @ 2020-04-25 15:36 玄空2 阅读(2322) 评论(0) 推荐(0) 编辑
摘要: Ioc容器的核心思想: 资源不由使用资源的双方管理,而由不使用资源的第三方管理 优点: 利用资源集中管理,实现资源的可配置和易管理。 降低了使用资源双方的依赖程度,即耦合度 阅读全文
posted @ 2020-04-25 14:53 玄空2 阅读(188) 评论(0) 推荐(0) 编辑
摘要: 配置Bean的作用域对象 在不指定@Scope的情况下,所有bean都是单例的,且是饿汉式加载(容器启动时就加载) @Lazy可以让其变为懒加载 在指定@Scope为prototype表示为多实例,且是懒汉式加载。 即IOC容器启动的时候,并不创建对象,而是第一次使用的时候才会创建。@Scope为p 阅读全文
posted @ 2020-04-25 14:33 玄空2 阅读(483) 评论(0) 推荐(0) 编辑
摘要: 1、配置类package com.configuration;import com.bean.Person;import com.tools.service.Service001;import org.springframework.context.annotation.Bean;import or 阅读全文
posted @ 2020-04-25 14:05 玄空2 阅读(422) 评论(0) 推荐(0) 编辑