use of org.springframework.context.ApplicationContext in project spring-framework by spring-projects.
the class AbstractApplicationContext method toString.
/**
* Return information about this context.
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder(getDisplayName());
sb.append(": startup date [").append(new Date(getStartupDate()));
sb.append("]; ");
ApplicationContext parent = getParent();
if (parent == null) {
sb.append("root of context hierarchy");
} else {
sb.append("parent: ").append(parent.getDisplayName());
}
return sb.toString();
}
use of org.springframework.context.ApplicationContext in project spring-framework by spring-projects.
the class JoinPointMonitorAtAspectJAspect method checkAtAspectJAspect.
private void checkAtAspectJAspect(String appContextFile) {
ApplicationContext context = new ClassPathXmlApplicationContext(appContextFile, getClass());
ICounter counter = (ICounter) context.getBean("counter");
assertTrue("Proxy didn't get created", counter instanceof Advised);
counter.increment();
JoinPointMonitorAtAspectJAspect callCountingAspect = (JoinPointMonitorAtAspectJAspect) context.getBean("monitoringAspect");
assertEquals("Advise didn't get executed", 1, callCountingAspect.beforeExecutions);
assertEquals("Advise didn't get executed", 1, callCountingAspect.aroundExecutions);
}
use of org.springframework.context.ApplicationContext in project spring-boot by spring-projects.
the class RemoteUrlPropertyExtractorTests method validUrl.
@Test
public void validUrl() throws Exception {
ApplicationContext context = doTest("http://localhost:8080");
assertThat(context.getEnvironment().getProperty("remoteUrl")).isEqualTo("http://localhost:8080");
assertThat(context.getEnvironment().getProperty("spring.thymeleaf.cache")).isNull();
}
use of org.springframework.context.ApplicationContext in project spring-boot by spring-projects.
the class MockRestServiceServerResetTestExecutionListener method afterTestMethod.
@Override
public void afterTestMethod(TestContext testContext) throws Exception {
ApplicationContext applicationContext = testContext.getApplicationContext();
String[] names = applicationContext.getBeanNamesForType(MockRestServiceServer.class, false, false);
for (String name : names) {
applicationContext.getBean(name, MockRestServiceServer.class).reset();
}
}
use of org.springframework.context.ApplicationContext in project spring-boot by spring-projects.
the class OverrideAutoConfigurationEnabledFalseIntegrationTest method disabledAutoConfiguration.
@Test
public void disabledAutoConfiguration() throws Exception {
ApplicationContext context = this.context;
assertThat(context.getBean(ExampleTestConfig.class)).isNotNull();
this.thrown.expect(NoSuchBeanDefinitionException.class);
context.getBean(ConfigurationPropertiesBindingPostProcessor.class);
}
Aggregations