Skip to content

Commit

Permalink
๐Ÿ› fix: trust Package ์ถ”๊ฐ€
Browse files Browse the repository at this point in the history
๐Ÿ› fix: trust Package ์ถ”๊ฐ€
  • Loading branch information
DDonghyeo authored Jul 1, 2024
2 parents 1f4bf5e + 48c75f2 commit c124a35
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public ConcurrentKafkaListenerContainerFactory<String, KafkaDto.UserMedianDto> u

private ConsumerFactory<String, KafkaDto.UserMedianDto> userMedianConsumerFactory() {
Map<String, Object> props = dtoSettings();
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KafkaDto.UserMedianDto.class));
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), createJsonDeserializer(KafkaDto.UserMedianDto.class));
}


Expand All @@ -106,7 +106,7 @@ public ConcurrentKafkaListenerContainerFactory<String, KafkaDto.UserSettingsDto>

private ConsumerFactory<String, KafkaDto.UserSettingsDto> userSettingsConsumerFactory() {
Map<String, Object> props = dtoSettings();
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KafkaDto.UserSettingsDto.class));
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), createJsonDeserializer(KafkaDto.UserSettingsDto.class));
}


Expand All @@ -122,7 +122,7 @@ public ConcurrentKafkaListenerContainerFactory<String, KafkaDto.InitialDataDto>

private ConsumerFactory<String, KafkaDto.InitialDataDto> initialDataConsumerFactory() {
Map<String, Object> 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")
Expand All @@ -137,10 +137,13 @@ public ConcurrentKafkaListenerContainerFactory<String, KafkaDto.WeatherDto> weat

private ConsumerFactory<String, KafkaDto.WeatherDto> weatherConsumerFactory() {
Map<String, Object> props = dtoSettings();
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), new JsonDeserializer<>(KafkaDto.WeatherDto.class));
return new DefaultKafkaConsumerFactory<>(props, new StringDeserializer(), createJsonDeserializer(KafkaDto.WeatherDto.class));
}



private <T> JsonDeserializer<T> createJsonDeserializer(Class<T> valueType) {
JsonDeserializer<T> jsonDeserializer = new JsonDeserializer<>(valueType);
jsonDeserializer.addTrustedPackages("com.waither.*");
return jsonDeserializer;
}

}

0 comments on commit c124a35

Please sign in to comment.