Skip to content

Commit

Permalink
let spring inject optional
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger committed Feb 28, 2024
1 parent debfd7c commit 3d21074
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import io.opentelemetry.sdk.autoconfigure.internal.EnvironmentResourceProvider;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
Expand All @@ -43,9 +42,8 @@ public ResourceProvider otelEnvironmentResourceProvider() {
}

@Bean
public ResourceProvider otelSpringResourceProvider(
@Autowired(required = false) BuildProperties buildProperties) {
return new SpringResourceProvider(Optional.ofNullable(buildProperties));
public ResourceProvider otelSpringResourceProvider(Optional<BuildProperties> buildProperties) {
return new SpringResourceProvider(buildProperties);
}

@Bean
Expand Down

0 comments on commit 3d21074

Please sign in to comment.