File tree Expand file tree Collapse file tree
test/java/com/baeldung/scope Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- package com .baeldung .scope ;
1+ package com .baeldung .config . scope ;
22
33import java .util .function .Function ;
44
5- import org .springframework .beans .factory .annotation .Qualifier ;
65import org .springframework .context .annotation .Bean ;
76import org .springframework .context .annotation .Configuration ;
87import org .springframework .context .annotation .Scope ;
Original file line number Diff line number Diff line change 1313import org .springframework .context .annotation .Scope ;
1414
1515@ Configuration
16- @ ComponentScan ("com.baeldung.scope" )
16+ @ ComponentScan (value = "com.baeldung.scope" )
1717public class AppConfig {
1818
1919 @ Bean
Original file line number Diff line number Diff line change 99import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
1010import org .springframework .test .context .support .AnnotationConfigContextLoader ;
1111
12- import com .baeldung .factorybean . FactoryBeanAppConfig ;
12+ import com .baeldung .config . scope . AppConfigFunctionBean ;
1313import com .baeldung .scope .prototype .PrototypeBean ;
1414import com .baeldung .scope .singletone .SingletonFunctionBean ;
1515
1616@ RunWith (SpringJUnit4ClassRunner .class )
17- @ ContextConfiguration (loader = AnnotationConfigContextLoader .class , classes = FactoryBeanAppConfig .class )
17+ @ ContextConfiguration (loader = AnnotationConfigContextLoader .class , classes = AppConfigFunctionBean .class )
1818public class PrototypeFunctionBeanIntegrationTest {
1919
20-
2120 @ Test
2221 public void givenPrototypeInjection_WhenFunction_ThenNewInstanceReturn () {
2322
24- AbstractApplicationContext context = new AnnotationConfigApplicationContext (AppConfig .class );
23+ AbstractApplicationContext context = new AnnotationConfigApplicationContext (AppConfigFunctionBean .class );
2524
2625 SingletonFunctionBean firstContext = context .getBean (SingletonFunctionBean .class );
2726 SingletonFunctionBean secondContext = context .getBean (SingletonFunctionBean .class );
You can’t perform that action at this time.
0 commit comments