摘要:
一、 Spring的bean默认是单例的 But sometimes you may find yourself working with a mutable class that does main-tain some state and therefore isn’t safe for reus 阅读全文
摘要:
一、 The @Qualifier annotation is the main way to work with qualifiers. It can beapplied alongside @Autowired or @Inject at the point of injection to sp 阅读全文
摘要:
一、 假设有如下三个类实现同一个接口,则自动装配时会产生歧义 1 @Component 2 public class Cake implements Dessert { ... } 3 @Component 4 public class Cookies implements Dessert { .. 阅读全文
摘要:
一、用@Conditional根据条件决定是否要注入bean 1. package com.habuma.restfun; public class MagicBean { } 2. package com.habuma.restfun; import org.springframework.con 阅读全文
摘要:
一、 Spring honors two separate properties when determining which profiles are active:spring.profiles.active and spring.profiles.default . If spring.pro 阅读全文
摘要:
一、 DataSource在应用和开发环境的产生方式不同,可以用srping 的profile管理 Spring’s solution for environment-specific beans isn’t much different from build-timesolutions. Cert 阅读全文
摘要:
一、在xml中引入xml,用<import> 1 <?xml version="1.0" encoding="UTF-8"?> 2 <beans xmlns="http://www.springframework.org/schema/beans" 3 xmlns:xsi="http://www.w 阅读全文
摘要:
1. package soundsystem; import org.springframework.beans.factory.annotation.Autowired; public class CDPlayer implements MediaPlayer { private CompactD 阅读全文
摘要:
一、注入简单属性 1 package soundsystem.properties; 2 import org.springframework.beans.factory.annotation.Autowired; 3 4 import soundsystem.CompactDisc; 5 impo 阅读全文
摘要:
一.当构造函数有集合时,只能用<CONSTRUCTOR-ARG>,不能用C-NAMESPACE 二、 1. 1 package soundsystem.collections; 2 3 import java.util.List; 4 5 import soundsystem.CompactDisc 阅读全文