From 48c75f2ad4114c9cca75bb6179b6f73e036d077c Mon Sep 17 00:00:00 2001 From: DDonghyeo Date: Mon, 1 Jul 2024 18:59:06 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20trust=20Package=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notiservice/config/KafkaConsumerConfig.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/noti-service/src/main/java/com/waither/notiservice/config/KafkaConsumerConfig.java b/noti-service/src/main/java/com/waither/notiservice/config/KafkaConsumerConfig.java index 24d01533..ac9b5e18 100644 --- a/noti-service/src/main/java/com/waither/notiservice/config/KafkaConsumerConfig.java +++ b/noti-service/src/main/java/com/waither/notiservice/config/KafkaConsumerConfig.java @@ -90,7 +90,7 @@ public ConcurrentKafkaListenerContainerFactory u private ConsumerFactory userMedianConsumerFactory() { Map props = dtoSettings(); - return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KafkaDto.UserMedianDto.class)); + return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), createJsonDeserializer(KafkaDto.UserMedianDto.class)); } @@ -106,7 +106,7 @@ public ConcurrentKafkaListenerContainerFactory private ConsumerFactory userSettingsConsumerFactory() { Map props = dtoSettings(); - return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KafkaDto.UserSettingsDto.class)); + return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), createJsonDeserializer(KafkaDto.UserSettingsDto.class)); } @@ -122,7 +122,7 @@ public ConcurrentKafkaListenerContainerFactory private ConsumerFactory initialDataConsumerFactory() { Map props = dtoSettings(); - return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KafkaDto.InitialDataDto.class)); + return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), createJsonDeserializer(KafkaDto.InitialDataDto.class)); } @Bean("weatherKafkaListenerContainerFactory") @@ -137,10 +137,13 @@ public ConcurrentKafkaListenerContainerFactory weat private ConsumerFactory weatherConsumerFactory() { Map props = dtoSettings(); - return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KafkaDto.WeatherDto.class)); + return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), createJsonDeserializer(KafkaDto.WeatherDto.class)); } - - + private JsonDeserializer createJsonDeserializer(Class valueType) { + JsonDeserializer jsonDeserializer = new JsonDeserializer<>(valueType); + jsonDeserializer.addTrustedPackages("com.waither.*"); + return jsonDeserializer; + } }