Spring autowired bean causes null pointer

后端 未结 5 1705
死守一世寂寞
死守一世寂寞 2020-12-19 04:55

I have a logger class that makes use of a service. Each time a new logger is created, I expect to have access to the singleton scoped logging service.

I autowire the

5条回答
  •  粉色の甜心
    2020-12-19 05:42

    When you create an object by new, autowire\inject don't work...

    See this link and this link for some workaround.

    Anyway if you would inject a logger i suggest you this my answer to another topic.

提交回复
热议问题