bean work
This commit is contained in:
parent
8555b95268
commit
94f9a60da1
|
@ -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();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue