IBM / cloud-native-starter

Cloud Native Starter for Java/Jakarta EE based Microservices on Kubernetes and Istio
https://cloud-native-starter.mybluemix.net/
Apache License 2.0
518 stars 273 forks source link

fix injection issue #7

Closed Emily-Jiang closed 5 years ago

Emily-Jiang commented 5 years ago

This fixes the injection issue. In CDI, when an instance is created, the constructor will be called first, followed by field injection. In your case, you tried to access the injected field, which has not been injected, in your constructor, which is why it is null. I added a postconstructor method, which will be called after constructor, field and method injection. At that time, the field injection would have been done. I tested and it works ok.

nheidloff commented 5 years ago

Thanks a lot, @Emily-Jiang