hi there found funny issue have kotlin config clas...
# spring
m
hi there found funny issue have kotlin config class for kafka
Copy code
@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
Copy code
@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
Copy code
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?
as I`ve understand from docks correct way for work with maps is
@Resource
annotation with
@Qualifier
.
Copy code
@Autowired <- replace it with @Resource
    @Qualifier("producerConfigs")
    Map<String, Object> producerConfigs;
But its still question why behavior is different in 2 modules