'Bean does not have a public constructor that does not take parameters' error despite clearly having one?

后端 未结 4 2043
小蘑菇
小蘑菇 2021-01-24 07:21

I have an EmailService EJB that has a very simple \'send_email\' method. I\'m receving the error in the title despite clearly having a public constructor that does not take para

4条回答
  •  忘了有多久
    2021-01-24 07:35

    The injection has not yet happened.

    In short:

    1. container calls the constructor
    2. then the injected fields get injected
    3. then the postconstruct stuff happens

    Thus extract the lookups, as suggested, into a postconstruct method

提交回复
热议问题