Alexandre A Barbosa
01/11/2023, 1:15 PM@Autowired
private AccountMapper mapper;
I want to avoid of instantiate a HttpClient builder every time in my @Component
class. Instead of do val client = HttpClient.newBuilder().build()
every time, please let me know how to inject it using Kotlin.Sam
01/11/2023, 1:17 PM@Configuration
class HttpClientConfiguration {
@Bean
fun httpClient(): HttpClient = HttpClient.newBuilder().build()
}
Davio
01/11/2023, 1:18 PMAlexandre A Barbosa
01/11/2023, 1:19 PMAlexandre A Barbosa
01/11/2023, 1:20 PMSam
01/11/2023, 1:21 PMDavio
01/11/2023, 1:22 PMAlexandre A Barbosa
01/11/2023, 1:24 PMDavio
01/11/2023, 1:25 PMSam
01/11/2023, 1:27 PMSam
01/11/2023, 1:28 PMAlexandre A Barbosa
01/11/2023, 1:30 PMAlexandre A Barbosa
01/11/2023, 1:30 PMSam
01/11/2023, 1:31 PMByteArray
-> Byte[]
use toTypedArray()
😉Alexandre A Barbosa
01/11/2023, 1:36 PMAlexandre A Barbosa
01/11/2023, 1:36 PMAlexandre A Barbosa
01/11/2023, 1:36 PMtoTypedArray()
but I didn’t manage toSam
01/11/2023, 1:37 PMByteArray
in Kotlin is equivalent to a java primitive byte[]
array. You can call .toTypedArray()
on it to convert it to a Kotlin Array<Byte>
, which is equivalent to a boxed Java Byte[]
array.Alexandre A Barbosa
01/11/2023, 1:40 PM