bean work

This commit is contained in:
eugenp 2013-05-25 00:03:27 +03:00
parent 8555b95268
commit 94f9a60da1
6 changed files with 15 additions and 18 deletions

View File

@ -1,13 +1,11 @@
package org.baeldung.web; package org.baeldung.web;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class BeanA implements InitializingBean { public class BeanA {
// @Autowired private IBeanC dependency;
// private IBeanC dependency;
public BeanA() { public BeanA() {
super(); super();
@ -15,10 +13,4 @@ public class BeanA implements InitializingBean {
// //
@Override
public void afterPropertiesSet() throws Exception {
System.out.println();
// throw new NullPointerException();
}
} }

View File

@ -3,9 +3,9 @@ package org.baeldung.web;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class BeanC implements IBeanC { public class BeanB implements IBeanB {
public BeanC() { public BeanB() {
super(); super();
} }

View File

@ -3,9 +3,9 @@ package org.baeldung.web;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class BeanB1 implements IBeanB { public class BeanC1 implements IBeanC {
public BeanB1() { public BeanC1() {
super(); super();
} }

View File

@ -3,9 +3,9 @@ package org.baeldung.web;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Component
public class BeanB2 implements IBeanB { public class BeanC2 implements IBeanB {
public BeanB2() { public BeanC2() {
super(); super();
} }

View File

@ -1,6 +1,9 @@
package org.baeldung.web; package org.baeldung.web;
public abstract class BeanD implements IBeanD { import org.springframework.stereotype.Component;
@Component
public class BeanD implements IBeanD {
public BeanD() { public BeanD() {
super(); super();

View File

@ -4,6 +4,8 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"> http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<bean id="beanD" class="org.baeldung.web.BeanD" /> <bean id="beanA" class="org.baeldung.web.BeanA">
<property name="beanC" ref="beanC" />
</bean>
</beans> </beans>