Spring-Kafka : Issue while deserialising kafka message - class not in a “trusted package”?

前端 未结 1 1245
予麋鹿
予麋鹿 2020-12-20 08:53

I get the below exception because I produce from one project and the consumer consumes from another project. How can I fix this. Obviously the packages are not the same. So

1条回答
  •  一个人的身影
    2020-12-20 09:24

    You can whitelist your package by changing assessmentAttemptDetailsEntityConsumerFactory() like this:

        @Bean
        public ConsumerFactory assessmentAttemptDetailsEntityConsumerFactory() {
                JsonDeserializer 
                deserializer = new JsonDeserializer<>();
                deserializer.addTrustedPackages("com.lte.assessment.assessments");//your package
            return new DefaultKafkaConsumerFactory(config,deserializer);
        }
    

    0 讨论(0)
提交回复
热议问题