hey team. I am noob with Kotlin and I am looking f...
# getting-started
a
hey team. I am noob with Kotlin and I am looking for a good way to call Spring OpenFeign. I shared a screenshot of how I am thinking to do, but the IDE is suggesting to use that
lateinit
… should I? In java I would inject the interface like this
@Autowired MyFeignClient client
and I can use it just like this
client.postMyData()
but please, how can I do this in Kotlin?
d
Copy code
@Component
class YourConsumer(
    private val client: MyFeignClient
) {
...
}
👍 1
a
got it
let me try here
j
Your primary problem is a Spring problem. Field injection is not recommended in java or kotlin. Constructor injection is the way to go
a
ok, but when this will injected?
I mean… when my controller call this service how should I do this?
nvm… I got it … actually I don’t need to call this service…
I will update here when I find out how to send my Kafka schema proto file to the topic
thank you @df
hey @df instead of Spring OpenFeign I used a simple Java 17 HTTP Client. But Feign worked when I implemented the
@Configuration
properly