Use scope prototype
This commit is contained in:
parent
f755fce0bb
commit
cd2ee40c06
|
@ -2,7 +2,9 @@ package org.baeldung.startup;
|
||||||
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
@Scope(value = "prototype")
|
@Scope(value = "prototype")
|
||||||
public class InitializingBeanExampleBean implements InitializingBean {
|
public class InitializingBeanExampleBean implements InitializingBean {
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package org.baeldung.startup;
|
package org.baeldung.startup;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
|
@Scope(value = "prototype")
|
||||||
public class PostConstructExampleBean {
|
public class PostConstructExampleBean {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
Loading…
Reference in New Issue