[bs-17], [bs-146] Add some ApplicationContextInitializers

* One for Cloud Foundry and one for the application context ID
* If app runs in Cloud Foundry vcap.application.* and vcap.services.*
will be populated in the Environment
* The ApplicationContext ID is set to something supposedly unique
(e.g. name:index in a Cloud Foundry app)

[#50968415] [#48153639]
This commit is contained in:
Dave Syer
2013-06-04 16:18:12 +01:00
parent e0d7fc2240
commit e60efc7e55
15 changed files with 813 additions and 4 deletions

View File

@@ -40,7 +40,6 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.event.ContextClosedEvent;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.ClassUtils;
@@ -103,8 +102,6 @@ public class ManagementAutoConfiguration implements ApplicationContextAware {
.getPort()) {
AnnotationConfigEmbeddedWebApplicationContext context = new AnnotationConfigEmbeddedWebApplicationContext();
context.setParent(ManagementAutoConfiguration.this.parent);
context.setEnvironment((ConfigurableEnvironment) ManagementAutoConfiguration.this.parent
.getEnvironment());
context.register(assembleConfigClasses(ManagementAutoConfiguration.this.parent));
context.refresh();
ManagementAutoConfiguration.this.context = context;