use of org.springframework.boot.LazyInitializationBeanFactoryPostProcessor in project spring-boot by spring-projects.
the class JmxEndpointIntegrationTests method jmxEndpointsAreExposedWhenLazyInitializationIsEnabled.
@Test
void jmxEndpointsAreExposedWhenLazyInitializationIsEnabled() {
this.contextRunner.withBean(LazyInitializationBeanFactoryPostProcessor.class, LazyInitializationBeanFactoryPostProcessor::new).run((context) -> {
MBeanServer mBeanServer = context.getBean(MBeanServer.class);
checkEndpointMBeans(mBeanServer, new String[] { "beans", "conditions", "configprops", "env", "health", "info", "mappings", "threaddump", "httptrace" }, new String[] { "shutdown" });
});
}
use of org.springframework.boot.LazyInitializationBeanFactoryPostProcessor in project spring-boot by spring-projects.
the class TaskSchedulingAutoConfigurationTests method enableSchedulingWithLazyInitializationInvokeScheduledMethods.
@Test
void enableSchedulingWithLazyInitializationInvokeScheduledMethods() {
List<String> threadNames = new ArrayList<>();
new ApplicationContextRunner().withInitializer((context) -> context.addBeanFactoryPostProcessor(new LazyInitializationBeanFactoryPostProcessor())).withPropertyValues("spring.task.scheduling.thread-name-prefix=scheduling-test-").withBean(LazyTestBean.class, () -> new LazyTestBean(threadNames)).withUserConfiguration(SchedulingConfiguration.class).withConfiguration(AutoConfigurations.of(TaskSchedulingAutoConfiguration.class)).run((context) -> {
// No lazy lookup.
Awaitility.waitAtMost(Duration.ofSeconds(3)).until(() -> !threadNames.isEmpty());
assertThat(threadNames).allMatch((name) -> name.contains("scheduling-test-"));
});
}
Aggregations