Skip to content

Commit

Permalink
🐛 fix: trust Package 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
DDonghyeo committed Jul 1, 2024
1 parent 1f4bf5e commit 48c75f2
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 48c75f2

Please sign in to comment.