Move ConditionalOnEnabledLoggingExport to opentelemetry module

This commit moves the `ConditionalOnEnabledLoggingExport` condition from
the "spring-boot-actuator-autoconfigure" to the
"spring-boot-opentelemetry" one, because without that the logging export
feature requires the actuator module to be on the classpath.

Fixes gh-48488
This commit is contained in:
Brian Clozel
2025-12-10 12:40:44 +01:00
parent 72afdfd94a
commit 192efca36e
7 changed files with 6 additions and 9 deletions
@@ -33,7 +33,6 @@ dependencies {
optional(project(":core:spring-boot-autoconfigure"))
optional(project(":core:spring-boot-docker-compose"))
optional(project(":core:spring-boot-testcontainers"))
optional(project(":module:spring-boot-actuator-autoconfigure"))
optional("io.opentelemetry:opentelemetry-exporter-otlp")
optional("org.testcontainers:testcontainers-grafana")
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.logging;
package org.springframework.boot.opentelemetry.autoconfigure.logging;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.logging;
package org.springframework.boot.opentelemetry.autoconfigure.logging;
import java.util.Map;
@@ -19,7 +19,6 @@ package org.springframework.boot.opentelemetry.autoconfigure.logging.otlp;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.sdk.logs.SdkLoggerProvider;
import org.springframework.boot.actuate.autoconfigure.logging.ConditionalOnEnabledLoggingExport;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
@@ -35,7 +34,7 @@ import org.springframework.context.annotation.Import;
* @since 4.0.0
*/
@AutoConfiguration
@ConditionalOnClass({ ConditionalOnEnabledLoggingExport.class, OpenTelemetry.class, SdkLoggerProvider.class })
@ConditionalOnClass({ OpenTelemetry.class, SdkLoggerProvider.class })
@EnableConfigurationProperties(OtlpLoggingProperties.class)
@Import({ ConnectionDetails.class, Exporters.class })
public final class OtlpLoggingAutoConfiguration {
@@ -25,11 +25,11 @@ import io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporter;
import io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogRecordExporterBuilder;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.actuate.autoconfigure.logging.ConditionalOnEnabledLoggingExport;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.opentelemetry.autoconfigure.logging.ConditionalOnEnabledLoggingExport;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.Assert;
@@ -19,8 +19,7 @@ package org.springframework.boot.opentelemetry.autoconfigure.logging.otlp;
import org.springframework.boot.autoconfigure.service.connection.ConnectionDetails;
/**
* Details required for actuator to establish a connection to an OpenTelemetry logging
* service.
* Details required to establish a connection to an OpenTelemetry logging service.
*
* @author Toshiaki Maki
* @since 4.0.0
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.actuate.autoconfigure.logging;
package org.springframework.boot.opentelemetry.autoconfigure.logging;
import java.util.Collections;
import java.util.Map;