@Configuration
public abstract class ExternalConfiguration ...{
![]()
@ExternalBean
public abstract HelloWorld helloWorld();
}
![]()
public class ConfigurationWithExternal ...{
public static void main(String[] args)...{
ApplicationContext context = new AnnotationApplicationContext(ConfigurationFull.class.getName(),ExternalConfiguration.class.getName());
HelloWorld hello = (HelloWorld)context.getBean("helloWorld");
hello.sayHello();
}
}
@Bean(scope = DefaultScopes.SESSION)
@ScopedProxy
public UserPreferences userPreferences() ...{
return new UserPreferences();
}
![]()
@Bean
public Service userService() ...{
UserService service = new SimpleUserService();
// a reference to the proxied 'userPreferences' bean
service.seUserPreferences(userPreferences());
return service;
}