Polish "Add auto-configuration for ObservedAspect"
See gh-35191
This commit is contained in:
parent
0dae89e837
commit
c726a13395
|
|
@ -180,6 +180,14 @@ class ObservationAutoConfigurationTests {
|
||||||
.run((context) -> assertThat(context).doesNotHaveBean(ObservedAspect.class));
|
.run((context) -> assertThat(context).doesNotHaveBean(ObservedAspect.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void allowsObservedAspectToBeCustomized() {
|
||||||
|
this.contextRunner.withUserConfiguration(CustomObservedAspectConfiguration.class)
|
||||||
|
.run((context) -> assertThat(context).hasSingleBean(ObservedAspect.class)
|
||||||
|
.getBean(ObservedAspect.class)
|
||||||
|
.isSameAs(context.getBean("customObservedAspect")));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void autoConfiguresObservationPredicates() {
|
void autoConfiguresObservationPredicates() {
|
||||||
this.contextRunner.withUserConfiguration(ObservationPredicates.class).run((context) -> {
|
this.contextRunner.withUserConfiguration(ObservationPredicates.class).run((context) -> {
|
||||||
|
|
@ -353,6 +361,16 @@ class ObservationAutoConfigurationTests {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Configuration(proxyBeanMethods = false)
|
||||||
|
static class CustomObservedAspectConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
ObservedAspect customObservedAspect(ObservationRegistry observationRegistry) {
|
||||||
|
return new ObservedAspect(observationRegistry);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
static class CustomGlobalObservationConvention {
|
static class CustomGlobalObservationConvention {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue