BeanNameAware and BeanFactoryAware
This commit is contained in:
parent
c1e0b884de
commit
4b91a76d8f
|
@ -74,6 +74,11 @@
|
|||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons.io.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -4,4 +4,8 @@ package com.baeldung.aware;
|
|||
* Created by Gebruiker on 4/24/2018.
|
||||
*/
|
||||
public class AwareExample {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package com.baeldung.aware;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class Config {
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.baeldung.aware;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
|
||||
/**
|
||||
* Created by Gebruiker on 4/25/2018.
|
||||
*/
|
||||
public class MyBeanFactory implements BeanFactoryAware {
|
||||
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
|
||||
this.beanFactory = beanFactory;
|
||||
System.out.println(beanFactory);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.baeldung.aware;
|
||||
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
|
||||
/**
|
||||
* Created by Gebruiker on 4/25/2018.
|
||||
*/
|
||||
public class MyBeanName implements BeanNameAware {
|
||||
|
||||
@Override
|
||||
public void setBeanName(String beanName) {
|
||||
System.out.println(beanName);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue