bean examples

This commit is contained in:
eugenp
2013-07-05 01:44:43 +03:00
parent ac29c2e553
commit bdc54a57b1
5 changed files with 62 additions and 0 deletions
@@ -0,0 +1,14 @@
package org.baeldung.di.core;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component
public class BeanA {
@Autowired
@Qualifier("beanB2")
private IBeanB dependency;
}
@@ -0,0 +1,8 @@
package org.baeldung.di.core;
import org.springframework.stereotype.Component;
@Component
public class BeanB implements IBeanB {
//
}
@@ -0,0 +1,5 @@
package org.baeldung.di.core;
public interface IBeanB {
//
}
@@ -0,0 +1,16 @@
package org.baeldung.di.spring;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan("org.baeldung.di")
public class ContextWithJavaConfig {
public ContextWithJavaConfig() {
super();
}
// beans
}