Deserialize kafka messages in KafkaConsumer using springboot
问题 I have a springboot app that listen kafka messages and convert them to object @KafkaListener(topics = "test", groupId = "group_id") public void consume(String message) throws IOException { ObjectMapper objectMapper = new ObjectMapper(); Hostel hostel = objectMapper.readValue(message, Hostel.class); } I woder if it is possible to do ti directly @KafkaListener(topics = "test", groupId = "group_id") public void consume(Hostel hostel) throws IOException { } 回答1: You can do it using spring-kafka .