bean work

This commit is contained in:
eugenp
2013-05-24 23:32:25 +03:00
parent 7245aa572a
commit 8555b95268
7 changed files with 42 additions and 6 deletions
@@ -0,0 +1,15 @@
package org.baeldung.spring.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@ImportResource("classpath:beansInXml.xml")
public class CoreConfig extends WebMvcConfigurerAdapter {
public CoreConfig() {
super();
}
}
@@ -14,6 +14,6 @@ public class WebConfig extends WebMvcConfigurerAdapter {
super();
}
// API
}
@@ -1,14 +1,13 @@
package org.baeldung.web;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class BeanA implements InitializingBean {
@Autowired
private IBeanC dependency;
// @Autowired
// private IBeanC dependency;
public BeanA() {
super();
@@ -19,6 +18,7 @@ public class BeanA implements InitializingBean {
@Override
public void afterPropertiesSet() throws Exception {
System.out.println();
// throw new NullPointerException();
}
}
@@ -1,10 +1,8 @@
package org.baeldung.web;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@Component
@Transactional
public class BeanC implements IBeanC {
public BeanC() {
@@ -0,0 +1,9 @@
package org.baeldung.web;
public abstract class BeanD implements IBeanD {
public BeanD() {
super();
}
}
@@ -0,0 +1,5 @@
package org.baeldung.web;
public interface IBeanD {
//
}