This is an automated email from the ASF dual-hosted git repository. Croway pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
commit e7850714524ecf845d90bc46e209cf9ef9b37d82 Author: Croway <[email protected]> AuthorDate: Mon Sep 28 14:06:23 2026 +0200 Fix Spring Boot daily test failures --- .../src/main/resources/archetype-resources/pom.xml | 7 +++ .../SpringKafkaPropertiesAutoConfiguration.java | 71 ++++++++++++++-------- .../component/sql/SqlTransactedRouteTest.java | 2 +- parent/pom.xml | 20 ++++++ pom.xml | 2 +- .../apache/camel/itest/springboot/CamelJoorIT.java | 2 +- tooling/camel-spring-boot-dependencies/pom.xml | 8 +-- 7 files changed, 79 insertions(+), 33 deletions(-) diff --git a/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/pom.xml b/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/pom.xml index 2aad17fed33..1acb7d0de2e 100644 --- a/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/pom.xml +++ b/archetypes/camel-archetype-spring-boot/src/main/resources/archetype-resources/pom.xml @@ -31,6 +31,8 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <spring.boot-version>${spring-boot-version}</spring.boot-version> + <!-- Spring Boot 4.1 manages jOOQ 3.20+, which requires Java 21. --> + <jooq.version>3.19.30</jooq.version> <surefire.plugin.version>3.0.0-M4</surefire.plugin.version> </properties> @@ -52,6 +54,11 @@ <type>pom</type> <scope>import</scope> </dependency> + <dependency> + <groupId>org.jooq</groupId> + <artifactId>jooq</artifactId> + <version>${jooq.version}</version> + </dependency> </dependencies> </dependencyManagement> diff --git a/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/SpringKafkaPropertiesAutoConfiguration.java b/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/SpringKafkaPropertiesAutoConfiguration.java index b338a8a1d6e..5f8a80e5b0a 100644 --- a/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/SpringKafkaPropertiesAutoConfiguration.java +++ b/components-starter/camel-kafka-starter/src/main/java/org/apache/camel/component/kafka/springboot/SpringKafkaPropertiesAutoConfiguration.java @@ -18,8 +18,11 @@ package org.apache.camel.component.kafka.springboot; import java.util.Map; -import jakarta.annotation.PostConstruct; - +import org.apache.camel.Ordered; +import org.apache.camel.Component; +import org.apache.camel.component.kafka.KafkaComponent; +import org.apache.camel.component.kafka.KafkaConfiguration; +import org.apache.camel.spi.ComponentCustomizer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.autoconfigure.AutoConfiguration; @@ -30,6 +33,8 @@ import org.springframework.boot.context.properties.bind.Bindable; import org.springframework.boot.context.properties.bind.Binder; import org.springframework.boot.kafka.autoconfigure.KafkaAutoConfiguration; import org.springframework.boot.kafka.autoconfigure.KafkaProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Lazy; import org.springframework.core.env.Environment; import org.springframework.core.io.Resource; @@ -59,34 +64,48 @@ public class SpringKafkaPropertiesAutoConfiguration { private static final String SPRING_KAFKA_PREFIX = "spring.kafka."; private final KafkaProperties kafkaProperties; - private final KafkaComponentConfiguration camelKafkaConfig; private final Binder binder; public SpringKafkaPropertiesAutoConfiguration( KafkaProperties kafkaProperties, - KafkaComponentConfiguration camelKafkaConfig, Environment environment) { this.kafkaProperties = kafkaProperties; - this.camelKafkaConfig = camelKafkaConfig; this.binder = Binder.get(environment); } - @PostConstruct - public void bridgeProperties() { + @Lazy + @Bean + public ComponentCustomizer configureSpringKafkaProperties() { + return new ComponentCustomizer() { + @Override + public void configure(String name, Component target) { + if (target instanceof KafkaComponent kafkaComponent) { + bridgeProperties(kafkaComponent.getConfiguration()); + } + } + + @Override + public int getOrder() { + return Ordered.LOWEST; + } + }; + } + + private void bridgeProperties(KafkaConfiguration configuration) { boolean bridged = false; // Bootstrap servers — KafkaProperties defaults to ["localhost:9092"], // so we must check if the user explicitly set spring.kafka.bootstrap-servers if (!isCamelPropertyBound("brokers") && isSpringPropertyBound("bootstrap-servers")) { String brokers = String.join(",", kafkaProperties.getBootstrapServers()); - camelKafkaConfig.setBrokers(brokers); + configuration.setBrokers(brokers); LOG.debug("Bridged spring.kafka.bootstrap-servers -> camel.component.kafka.brokers: {}", brokers); bridged = true; } // Client ID if (!isCamelPropertyBound("client-id") && kafkaProperties.getClientId() != null) { - camelKafkaConfig.setClientId(kafkaProperties.getClientId()); + configuration.setClientId(kafkaProperties.getClientId()); LOG.debug("Bridged spring.kafka.client-id -> camel.component.kafka.client-id"); bridged = true; } @@ -95,7 +114,7 @@ public class SpringKafkaPropertiesAutoConfiguration { if (!isCamelPropertyBound("security-protocol") && kafkaProperties.getSecurity() != null && kafkaProperties.getSecurity().getProtocol() != null) { - camelKafkaConfig.setSecurityProtocol(kafkaProperties.getSecurity().getProtocol()); + configuration.setSecurityProtocol(kafkaProperties.getSecurity().getProtocol()); LOG.debug("Bridged spring.kafka.security.protocol -> camel.component.kafka.security-protocol"); bridged = true; } @@ -104,23 +123,23 @@ public class SpringKafkaPropertiesAutoConfiguration { if (!isCamelPropertyBound("group-id") && kafkaProperties.getConsumer() != null && kafkaProperties.getConsumer().getGroupId() != null) { - camelKafkaConfig.setGroupId(kafkaProperties.getConsumer().getGroupId()); + configuration.setGroupId(kafkaProperties.getConsumer().getGroupId()); LOG.debug("Bridged spring.kafka.consumer.group-id -> camel.component.kafka.group-id"); bridged = true; } // SSL properties - bridged |= bridgeSslProperties(); + bridged |= bridgeSslProperties(configuration); // SASL properties from spring.kafka.properties map - bridged |= bridgeSaslProperties(); + bridged |= bridgeSaslProperties(configuration); if (bridged) { LOG.info("Bridged spring.kafka.* properties to camel.component.kafka.*"); } } - private boolean bridgeSslProperties() { + private boolean bridgeSslProperties(KafkaConfiguration configuration) { KafkaProperties.Ssl ssl = kafkaProperties.getSsl(); if (ssl == null) { return false; @@ -129,35 +148,35 @@ public class SpringKafkaPropertiesAutoConfiguration { boolean bridged = false; if (!isCamelPropertyBound("ssl-key-password") && ssl.getKeyPassword() != null) { - camelKafkaConfig.setSslKeyPassword(ssl.getKeyPassword()); + configuration.setSslKeyPassword(ssl.getKeyPassword()); bridged = true; } if (!isCamelPropertyBound("ssl-keystore-location") && ssl.getKeyStoreLocation() != null) { - camelKafkaConfig.setSslKeystoreLocation(resourceToPath(ssl.getKeyStoreLocation())); + configuration.setSslKeystoreLocation(resourceToPath(ssl.getKeyStoreLocation())); bridged = true; } if (!isCamelPropertyBound("ssl-keystore-password") && ssl.getKeyStorePassword() != null) { - camelKafkaConfig.setSslKeystorePassword(ssl.getKeyStorePassword()); + configuration.setSslKeystorePassword(ssl.getKeyStorePassword()); bridged = true; } if (!isCamelPropertyBound("ssl-keystore-type") && ssl.getKeyStoreType() != null) { - camelKafkaConfig.setSslKeystoreType(ssl.getKeyStoreType()); + configuration.setSslKeystoreType(ssl.getKeyStoreType()); bridged = true; } if (!isCamelPropertyBound("ssl-truststore-location") && ssl.getTrustStoreLocation() != null) { - camelKafkaConfig.setSslTruststoreLocation(resourceToPath(ssl.getTrustStoreLocation())); + configuration.setSslTruststoreLocation(resourceToPath(ssl.getTrustStoreLocation())); bridged = true; } if (!isCamelPropertyBound("ssl-truststore-password") && ssl.getTrustStorePassword() != null) { - camelKafkaConfig.setSslTruststorePassword(ssl.getTrustStorePassword()); + configuration.setSslTruststorePassword(ssl.getTrustStorePassword()); bridged = true; } if (!isCamelPropertyBound("ssl-truststore-type") && ssl.getTrustStoreType() != null) { - camelKafkaConfig.setSslTruststoreType(ssl.getTrustStoreType()); + configuration.setSslTruststoreType(ssl.getTrustStoreType()); bridged = true; } if (!isCamelPropertyBound("ssl-protocol") && ssl.getProtocol() != null) { - camelKafkaConfig.setSslProtocol(ssl.getProtocol()); + configuration.setSslProtocol(ssl.getProtocol()); bridged = true; } @@ -167,7 +186,7 @@ public class SpringKafkaPropertiesAutoConfiguration { return bridged; } - private boolean bridgeSaslProperties() { + private boolean bridgeSaslProperties(KafkaConfiguration configuration) { Map<String, String> rawProps = kafkaProperties.getProperties(); if (rawProps == null || rawProps.isEmpty()) { return false; @@ -177,19 +196,19 @@ public class SpringKafkaPropertiesAutoConfiguration { if (!isCamelPropertyBound("sasl-mechanism") && rawProps.containsKey("sasl.mechanism")) { - camelKafkaConfig.setSaslMechanism(rawProps.get("sasl.mechanism")); + configuration.setSaslMechanism(rawProps.get("sasl.mechanism")); LOG.debug("Bridged spring.kafka.properties[sasl.mechanism] -> camel.component.kafka.sasl-mechanism"); bridged = true; } if (!isCamelPropertyBound("sasl-jaas-config") && rawProps.containsKey("sasl.jaas.config")) { - camelKafkaConfig.setSaslJaasConfig(rawProps.get("sasl.jaas.config")); + configuration.setSaslJaasConfig(rawProps.get("sasl.jaas.config")); LOG.debug("Bridged spring.kafka.properties[sasl.jaas.config] -> camel.component.kafka.sasl-jaas-config"); bridged = true; } if (!isCamelPropertyBound("sasl-kerberos-service-name") && rawProps.containsKey("sasl.kerberos.service.name")) { - camelKafkaConfig.setSaslKerberosServiceName(rawProps.get("sasl.kerberos.service.name")); + configuration.setSaslKerberosServiceName(rawProps.get("sasl.kerberos.service.name")); LOG.debug("Bridged spring.kafka.properties[sasl.kerberos.service.name] -> camel.component.kafka.sasl-kerberos-service-name"); bridged = true; } diff --git a/components-starter/camel-sql-starter/src/test/java/org/apache/camel/component/sql/SqlTransactedRouteTest.java b/components-starter/camel-sql-starter/src/test/java/org/apache/camel/component/sql/SqlTransactedRouteTest.java index c2bb7e5b60f..b3665dfc54d 100644 --- a/components-starter/camel-sql-starter/src/test/java/org/apache/camel/component/sql/SqlTransactedRouteTest.java +++ b/components-starter/camel-sql-starter/src/test/java/org/apache/camel/component/sql/SqlTransactedRouteTest.java @@ -55,7 +55,7 @@ public class SqlTransactedRouteTest extends BaseSql { private JdbcTemplate jdbc; private static String startEndpoint = "direct:start"; - private static String sqlEndpoint = "sql:overriddenByTheHeader?dataSource=#testdb"; + private static String sqlEndpoint = "sql:overriddenByTheHeader?dataSource=#testdb&allowQueryFromHeader=true"; @Autowired private DataSource ds; diff --git a/parent/pom.xml b/parent/pom.xml index 588908139a2..ba9ef2f2d63 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -66,6 +66,26 @@ <artifactId>jooq</artifactId> <version>${jooq-version}</version> </dependency> + <dependency> + <groupId>org.apache.avro</groupId> + <artifactId>avro</artifactId> + <version>${avro-version}</version> + </dependency> + <dependency> + <groupId>org.apache.avro</groupId> + <artifactId>avro-ipc</artifactId> + <version>${avro-version}</version> + </dependency> + <dependency> + <groupId>org.apache.avro</groupId> + <artifactId>avro-mapred</artifactId> + <version>${avro-version}</version> + </dependency> + <dependency> + <groupId>org.apache.avro</groupId> + <artifactId>avro-protobuf</artifactId> + <version>${avro-version}</version> + </dependency> </dependencies> </dependencyManagement> diff --git a/pom.xml b/pom.xml index 43edee7cf0b..a6bdd0f4c32 100644 --- a/pom.xml +++ b/pom.xml @@ -118,7 +118,7 @@ <camel-version>4.23.0-SNAPSHOT</camel-version> <!-- versions --> - <avro-version>1.12.0</avro-version> + <avro-version>1.12.2</avro-version> <jakarta-jaxb-version>4.0.5</jakarta-jaxb-version> <jaxb-version>2.3.0</jaxb-version> <license-maven-plugin-version>5.1.2</license-maven-plugin-version> diff --git a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJoorIT.java b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJoorIT.java index f97eb910d42..ff31e3b03c3 100644 --- a/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJoorIT.java +++ b/tests/camel-itest-spring-boot/src/test/java/org/apache/camel/itest/springboot/CamelJoorIT.java @@ -23,6 +23,6 @@ public class CamelJoorIT extends AbstractSpringBootBaseTestSupport { @Test void languageTest() { - assertLanguage(inferComponentName(getClass())); + assertLanguage("java"); } } diff --git a/tooling/camel-spring-boot-dependencies/pom.xml b/tooling/camel-spring-boot-dependencies/pom.xml index f271f509c04..f726d7d0687 100644 --- a/tooling/camel-spring-boot-dependencies/pom.xml +++ b/tooling/camel-spring-boot-dependencies/pom.xml @@ -325,22 +325,22 @@ <dependency> <groupId>org.apache.avro</groupId> <artifactId>avro</artifactId> - <version>1.12.0</version> + <version>1.12.2</version> </dependency> <dependency> <groupId>org.apache.avro</groupId> <artifactId>avro-ipc</artifactId> - <version>1.12.0</version> + <version>1.12.2</version> </dependency> <dependency> <groupId>org.apache.avro</groupId> <artifactId>avro-mapred</artifactId> - <version>1.12.0</version> + <version>1.12.2</version> </dependency> <dependency> <groupId>org.apache.avro</groupId> <artifactId>avro-protobuf</artifactId> - <version>1.12.0</version> + <version>1.12.2</version> </dependency> <dependency> <groupId>org.apache.camel.maven</groupId>
