Open
Description
Due to Java type erasure, currently I have to manually determine the type of the event's config when listening to this event:
@Component
class EurekaInstanceConfigPostProcessor(
private val eureka: EurekaRegistration,
) : ApplicationListener<InstanceRegisteredEvent<*>> {
override fun onApplicationEvent(event: InstanceRegisteredEvent<*>) {
if (event.config is EurekaInstanceConfigBean){
eureka.applicationInfoManager.registerAppMetadata(......)
}
}
}
If InstanceRegisteredEvent can implement ResolvableTypeProvider, i can directly listening and set it's config type:
@Component
class EurekaInstanceConfigPostProcessor(
private val eureka: EurekaRegistration,
) : ApplicationListener<InstanceRegisteredEvent<EurekaInstanceConfigBean>> {
override fun onApplicationEvent(event: InstanceRegisteredEvent<EurekaInstanceConfigBean>) {
eureka.applicationInfoManager.registerAppMetadata(......)
}
}