You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make AbstractApplicationContext BeanNameAware [SPR-4384] #9063
I've added a "getId()" method to the ApplicationContext interface, with a corresponding "setId" in AbstractApplicationContext class. The newly introduced AbstractRefreshableConfigApplicationContext base class (which ClassPathXmlApplicationContext and FileSystemXmlApplicationContext derive from) implements BeanNameAware and calls "setId" with the bean name if no id has been configured explicitly.
Furthermore, ClassPathXmlApplicationContext and FileSystemXmlApplicationContext allow for bean-style configuration now, with default constructors, "configLocation" and "configLocations" properties and automatic refresh triggered by the afterPropertiesSet callback. This is what I would consider the preferred way of setting up a context in a beanRefContext file, with full configurability and proper bean-style initialization phase (which BeanNameAware is a part of).
Activity
spring-projects-issues commentedon Feb 4, 2008
Juergen Hoeller commented
I've added a "getId()" method to the ApplicationContext interface, with a corresponding "setId" in AbstractApplicationContext class. The newly introduced AbstractRefreshableConfigApplicationContext base class (which ClassPathXmlApplicationContext and FileSystemXmlApplicationContext derive from) implements BeanNameAware and calls "setId" with the bean name if no id has been configured explicitly.
Furthermore, ClassPathXmlApplicationContext and FileSystemXmlApplicationContext allow for bean-style configuration now, with default constructors, "configLocation" and "configLocations" properties and automatic refresh triggered by the afterPropertiesSet callback. This is what I would consider the preferred way of setting up a context in a beanRefContext file, with full configurability and proper bean-style initialization phase (which BeanNameAware is a part of).
<bean id="myContext" class="org.springframework.context.support.ClassPathXmlApplicationContext">
<property name="configLocation" value="myPackage/myBeans.xml"/>
</bean>
Juergen
spring-projects-issues commentedon Feb 4, 2008
Kenny MacLeod commented
Outstanding work as always. Thanks.