mp
04/11/2018, 9:48 PM@Configuration
class KafkaConfigurator(
@Value("\${kafka.bootstrap-servers}") val bootstrapServers: String,
@Value("\${kafka.consumer.group-id}") val groupId: String,
@Value("\${kafka.consumer.auto-offset-reset}") val autoOffsetReset: String,
@Autowired val objectMapper: ObjectMapper
) {
//bla bla bla, few more beans
@Bean
@Qualifier("producerConfigs")
fun producerConfigs() = HashMap<String, Any>().apply { //values }
@Bean
@Qualifier("consumerConfigs")
fun consumerConfigs() = HashMap<String, Any>().apply { //values }
}
and I`m using it in 2 modules: one written on koltin+spring (1.5.12). here injections looks like
@EnableKafka
@EnableAsync
@Configuration
class KafkaConfig(
@Autowired val stringJsonMessageConverter: StringJsonMessageConverter,
@Autowired @Qualifier("producerConfigs") val producerConfigs: Map<String, Any>,
@Value("\${kafka.topics.companies}") val companiesTopic: String,
@Value("\${kafka.topics.customers}") val customersTopic: String
)
and another written on java+spring (1.5.12). here injections looks like
public class Application extends ResourceServerConfigurerAdapter {
@Autowired
@Qualifier("producerConfigs")
Map<String, Object> producerConfigs;
@Autowired
StringJsonMessageConverter messageConverter;
}
so issue is that on injection to kotlin module - I have correct map with values that I want to get.
But on injection to the java module I got map with key "producerConfigs" and value that contains map that I exactly need.
wdyt - should it be reported some were to the spring github or something another?mp
04/12/2018, 9:00 AM@Resource
annotation with @Qualifier
.
@Autowired <- replace it with @Resource
@Qualifier("producerConfigs")
Map<String, Object> producerConfigs;
But its still question why behavior is different in 2 modules