micronaut-http-client not configuration properties not working
- Dominant language
- Groovy
- Stars
- 2.9k
- Forks
- 975
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 92
Description
### Issue description
I am new to the concept of micronaut-http-client and it's inner working. I have been following https://guides.grails.org/grails-micronaut-http/guide/index.html and https://docs.micronaut.io/latest/guide/#clientConfiguration. With these I am able to make a blocking http request to my service. However, I have tirelessly tried and failed to inject configuration via application.yml
```
micronaut:
codec:
json:
additionalTypes:
- text/javascript
http:
client:
read-idle-timeout: 1m
max-content-length: 10m
read-timeout: 30s
```
```
build.gradle
developmentOnly("org.springframework.boot:spring-boot-devtools")
compileOnly "io.micronaut:micronaut-inject-groovy"
console "org.grails:grails-console"
implementation "org.springframework.boot:spring-boot-starter-logging"
implementation "org.springframework.boot:spring-boot-starter-validation"
implementation "org.springframework.boot:spring-boot-autoconfigure"
implementation "org.grails:grails-core"
implementation "org.springframework.boot:spring-boot-starter-actuator"
implementation "org.springframework.boot:spring-boot-starter-tomcat"
implementation "org.grails:grails-web-boot"
implementation "org.grails:grails-logging"
implementation "org.grails:grails-plugin-rest"
implementation "org.grails:grails-plugin-codecs"
implementation "org.grails:grails-plugin-databinding"
implementation "org.grails:grails-plugin-i18n"
implementation "org.grails:grails-plugin-services"
implementation "org.grails:grails-plugin-url-mappings"
implementation "org.grails:grails-plugin-interceptors"
// implementation "org.grails:grails-plugin-services"
// implementation "org.grails:grails-plugin-datasource"
// implementation "org.grails:grails-plugin-databinding"
// implementation "org.grails:grails-web-boot"
// implementation "org.grails:grails-logging"
implementation "org.grails.plugins:cache"
implementation "org.grails.plugins:async"
implementation "org.grails.plugins:scaffolding"
implementation "org.grails.plugins:hibernate5"
implementation "org.hibernate:hibernate-core:5.6.5.Final"
implementation "org.grails.plugins:views-json"
implementation "org.grails.plugins:views-json-templates"
// profile "org.grails.profiles:react"
implementation "org.grails.plugins:events"
implementation "org.grails.plugins:gsp"
profile "org.grails.profiles:web"
runtimeOnly "org.glassfish.web:el-impl:2.2.1-b05"
runtimeOnly "com.h2database:h2"
runtimeOnly "org.apache.tomcat:tomcat-jdbc"
runtimeOnly "javax.xml.bind:jaxb-api:2.3.1"
runtimeOnly "com.bertramlabs.plugins:asset-pipeline-grails:3.3.4"
testImplementation "org.grails:grails-gorm-testing-support"
testImplementation "org.mockito:mockito-core"
implementation("io.micronaut:micronaut-http-client")
implementation("io.projectreactor:reactor-core:3.4.14")
```
code to make http blocking call
```
def makeBlockingCall(requestFormat) {
String baseUrl = Holders.config.grails.url
HttpClient client = HttpClient.create(baseUrl.toURL())
HttpRequest request = HttpRequest.POST(UriBuilder.of('/')
.build(), requestFormat)
.contentType(MediaType.APPLICATION_JSON)
.header("client-id","xxx")
.header("client-name","xxx")
.header("ticket","xxx")
def response = Mono.from(client.exchange(request, String))
.block()
.body()
ObjectMapper objectMapper = new ObjectMapper()
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true)
return objectMapper.readValue(response, ResponseFormat)
}
```
When I make an http request as per the configuration the request doesn't wait until 30s before timing out but resorts to default always.
Contributor guide
Assessment
This issue has not been assessed yet.