Kotlin call java method with Class argument

前端 未结 4 694
忘了有多久
忘了有多久 2021-02-04 01:39

I want to use Spring RestTemplate in Kotlin like this:

//import org.springframework.web.client.RestTemplate
fun findAllUsers(): List {
          


        
4条回答
  •  野的像风
    2021-02-04 02:13

    You may try

    return restTemplate.getForObject(URI(hostAddress), Array::class.java).toList()
    

提交回复
热议问题