[
https://issues.apache.org/jira/browse/CAMEL-19851?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Valeriy Ak updated CAMEL-19851:
-------------------------------
Description:
In http component we have some properties with type
org.apache.hc.core5.util.Timeout:
* camel.component.http.connect-timeout
* camel.component.http.connection-request-timeout
* camel.component.http.response-timeout
* camel.component.http.so-timeout{*}{{*}}
We can set this properies by spring boot prop file
([documentation|https://camel.apache.org/components/4.0.x/http-component.html#_spring_boot_auto_configuration]).
However in current realization it is not posible to set thouse values because
converter don't create Timeout object, it try to get bean with this name from
spring context
[HttpComponentConverter|https://github.com/apache/camel-spring-boot/blob/camel-spring-boot-4.0.x/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConverter.java#L77]
, if bean not present it alwayes return null value.
It is not correct behavior - and correct way is convert value to [Duration
|https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.conversion.durations]and
the call Timeout.of(duration)
Please fix converter for org.apache.hc.core5.util.Timeout class
Examples:
{code:java}
camel:
component:
http:
so-timeout: PT30S
---
bean HttpComponentConfiguration.soTimeout=null
camel:
component:
http:
so-timeout: 1000
---
Exception on start - Caused by:
org.springframework.core.convert.ConverterNotFoundException: No converter found
capable of converting from type [java.lang.Integer] to type
[org.apache.hc.core5.util.Timeout]{code}
was:
In http component we have some properties with type
org.apache.hc.core5.util.Timeout:
* camel.component.http.connect-timeout
* camel.component.http.connection-request-timeout
* camel.component.http.response-timeout
* camel.component.http.so-timeout{*}{*}
We can set this properies by spring boot prop file
([documentation|https://camel.apache.org/components/4.0.x/http-component.html#_spring_boot_auto_configuration]).
However in current realization it is not posible to set thouse values because
converter don't create Timeout object, it try to get bean with this name from
spring context
[HttpComponentConverter|https://github.com/apache/camel-spring-boot/blob/camel-spring-boot-4.0.x/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConverter.java#L77]
, if bean not present it alwayes return null value.
It is not correct behavior - and correct way is convert value to [Duration
|https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.conversion.durations]and
the call Timeout.of(duration)
Please fix converter for org.apache.hc.core5.util.Timeout class
> Spring-boot auto-configuration do not works for type Timeout
> ------------------------------------------------------------
>
> Key: CAMEL-19851
> URL: https://issues.apache.org/jira/browse/CAMEL-19851
> Project: Camel
> Issue Type: Bug
> Components: camel-http
> Affects Versions: 4.x
> Environment:
>
> Reporter: Valeriy Ak
> Priority: Major
>
> In http component we have some properties with type
> org.apache.hc.core5.util.Timeout:
> * camel.component.http.connect-timeout
> * camel.component.http.connection-request-timeout
> * camel.component.http.response-timeout
> * camel.component.http.so-timeout{*}{{*}}
> We can set this properies by spring boot prop file
> ([documentation|https://camel.apache.org/components/4.0.x/http-component.html#_spring_boot_auto_configuration]).
>
>
> However in current realization it is not posible to set thouse values because
> converter don't create Timeout object, it try to get bean with this name from
> spring context
> [HttpComponentConverter|https://github.com/apache/camel-spring-boot/blob/camel-spring-boot-4.0.x/components-starter/camel-http-starter/src/main/java/org/apache/camel/component/http/springboot/HttpComponentConverter.java#L77]
> , if bean not present it alwayes return null value.
>
> It is not correct behavior - and correct way is convert value to [Duration
> |https://docs.spring.io/spring-boot/docs/current/reference/html/features.html#features.external-config.typesafe-configuration-properties.conversion.durations]and
> the call Timeout.of(duration)
>
> Please fix converter for org.apache.hc.core5.util.Timeout class
>
> Examples:
> {code:java}
> camel:
> component:
> http:
> so-timeout: PT30S
> ---
> bean HttpComponentConfiguration.soTimeout=null
> camel:
> component:
> http:
> so-timeout: 1000
> ---
> Exception on start - Caused by:
> org.springframework.core.convert.ConverterNotFoundException: No converter
> found capable of converting from type [java.lang.Integer] to type
> [org.apache.hc.core5.util.Timeout]{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)