@Test public void testGetProperty() throws Exception { logger.info("testGetProperty()"); SpringContext context = new SpringContext(null, "classpath:contexts/propContext.xml"); BeanDefinition bean = context.getBean("example"); assertNotNull("able to find bean", bean); assertEquals("extracted property as string in attribute", "foo", bean.getPropertyAsString("propAsStringAttribute")); assertEquals("extracted property as string in value", "bar", bean.getPropertyAsString("propAsStringValue")); assertEquals("extracted property as ref", "example", bean.getPropertyAsRefId("propAsRefId")); Properties propsProp1 = bean.getPropertyAsProperties("propAsSingleValue"); assertNotNull("able to extract property with name-value props", propsProp1); assertEquals("extracted property for 'foo'", "bar", propsProp1.get("foo")); assertEquals("extracted property for 'argle'", "bargle", propsProp1.get("argle")); Properties propsProp2 = bean.getPropertyAsProperties("propAsExplicitProperties"); assertNotNull("able to extract property with explicit props", propsProp2); assertEquals("extracted property for 'foo'", "bar", propsProp2.get("foo")); assertEquals("extracted property for 'argle'", "bargle", propsProp2.get("argle")); }
public BeanDefinition getBean(String name) { BeanDefinition def = beanDefinitionsById.get(name); if (def == null) def = beanDefinitionsByName.get(name); return def; }
SpringContext { public BeanDefinition getBean(String name) { BeanDefinition def = beanDefinitionsById.get(name); if (def == null) def = beanDefinitionsByName.get(name); return def; } }
SpringContext { public BeanDefinition getBean(String name) { BeanDefinition def = beanDefinitionsById.get(name); if (def == null) def = beanDefinitionsByName.get(name); return def; } SpringContext(WarMachine war, String contextLocation);  SpringContext(SpringContext parent, WarMachine war, String contextLocation); }
SpringContext { public BeanDefinition getBean(String name) { BeanDefinition def = beanDefinitionsById.get(name); if (def == null) def = beanDefinitionsByName.get(name); return def; } SpringContext(WarMachine war, String contextLocation);  SpringContext(SpringContext parent, WarMachine war, String contextLocation); Map<String,BeanDefinition> getBeans(); BeanDefinition getBean(String name); List<BeanDefinition> getBeansByClass(String className); }
SpringContext { public BeanDefinition getBean(String name) { BeanDefinition def = beanDefinitionsById.get(name); if (def == null) def = beanDefinitionsByName.get(name); return def; } SpringContext(WarMachine war, String contextLocation);  SpringContext(SpringContext parent, WarMachine war, String contextLocation); Map<String,BeanDefinition> getBeans(); BeanDefinition getBean(String name); List<BeanDefinition> getBeansByClass(String className);  }