File tree Expand file tree Collapse file tree 7 files changed +19
-106
lines changed
src/main/kotlin/com/baeldung
configurationproperties/config Expand file tree Collapse file tree 7 files changed +19
-106
lines changed Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 82
82
83
83
<aspectjweaver .version>1.9.1</aspectjweaver .version>
84
84
<rest-assured .version>3.3.0</rest-assured .version>
85
- <logback .version>1.4.4 </logback .version>
85
+ <logback .version>1.5.6 </logback .version>
86
86
<org .slf4j.version>2.0.3</org .slf4j.version>
87
87
<!-- for spring-boot 3 we need java 17 minimum -->
88
88
<java .version>17</java .version>
89
- <spring-boot .version>3.2.4 </spring-boot .version>
89
+ <spring-boot .version>3.3.0 </spring-boot .version>
90
90
91
91
<!-- plugins -->
92
92
<thin .version>1.0.22.RELEASE</thin .version>
Original file line number Diff line number Diff line change 485
485
</build >
486
486
487
487
<modules >
488
- <module >parent-boot-2</module >
489
488
<module >parent-boot-3</module >
490
489
491
490
<module >core-kotlin-companion</module >
567
566
</build >
568
567
569
568
<modules >
570
- <module >parent-boot-2</module >
571
569
<module >parent-boot-3</module >
572
570
573
571
<module >core-kotlin-companion</module >
Original file line number Diff line number Diff line change 9
9
10
10
<parent >
11
11
<groupId >com.baeldung</groupId >
12
- <artifactId >parent-boot-2 </artifactId >
12
+ <artifactId >parent-boot-3 </artifactId >
13
13
<version >1.0.0-SNAPSHOT</version >
14
- <relativePath >../parent-boot-2 </relativePath >
14
+ <relativePath >../parent-boot-3 </relativePath >
15
15
</parent >
16
16
17
17
<dependencies >
52
52
<artifactId >junit-jupiter-api</artifactId >
53
53
<scope >test</scope >
54
54
</dependency >
55
+ <dependency >
56
+ <groupId >org.apache.httpcomponents.client5</groupId >
57
+ <artifactId >httpclient5</artifactId >
58
+ <version >${httpclient5.version} </version >
59
+ </dependency >
55
60
</dependencies >
56
61
57
-
58
62
<build >
59
63
<sourceDirectory >src/main/kotlin</sourceDirectory >
60
64
<testSourceDirectory >src/test/kotlin</testSourceDirectory >
111
115
112
116
<properties >
113
117
<kotlin .version>1.9.24</kotlin .version>
118
+ <httpclient5 .version>5.3.1</httpclient5 .version>
114
119
</properties >
115
120
116
121
</project >
Original file line number Diff line number Diff line change 1
1
package com.baeldung.configurationproperties.config
2
2
import org.springframework.boot.context.properties.ConfigurationProperties
3
- import org.springframework.boot.context.properties.ConstructorBinding
3
+ import org.springframework.boot.context.properties.bind. ConstructorBinding
4
4
5
5
@ConfigurationProperties(prefix = " api" )
6
- @ConstructorBinding
7
- data class ApiConfiguration (
6
+ data class ApiConfiguration /* @ConstructorBinding constructor*/ (
8
7
val clientId : String ,
9
8
val url : String ,
10
9
val key : String
Original file line number Diff line number Diff line change 1
1
package com.baeldung.resttemplate.config
2
2
3
+ import org.springframework.boot.web.client.RestTemplateBuilder
3
4
import org.springframework.context.annotation.Bean
4
5
import org.springframework.context.annotation.Configuration
5
6
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory
6
7
import org.springframework.web.client.RestTemplate
8
+ import java.time.Duration
7
9
8
10
@Configuration
9
11
class RestTemplateConfig {
10
12
11
13
@Bean(" restTemplateCustom" )
12
14
fun restTemplate (): RestTemplate {
13
- val restTemplate = RestTemplate ()
14
15
val requestFactory = HttpComponentsClientHttpRequestFactory ()
15
- requestFactory.setConnectTimeout(5000 )
16
- requestFactory.setReadTimeout(5000 )
17
- restTemplate.requestFactory = requestFactory;
16
+ val restTemplateBuilder = RestTemplateBuilder ()
17
+ restTemplateBuilder.setReadTimeout(Duration .ofMillis(5_000 ))
18
+ restTemplateBuilder.setReadTimeout(Duration .ofMillis(5_000 ))
19
+ val restTemplate = restTemplateBuilder.build()
20
+ restTemplate.requestFactory = requestFactory
18
21
19
22
return restTemplate;
20
23
}
You can’t perform that action at this time.
0 commit comments