Is Spring @autowired not meant for non-singleton containers?

后端 未结 4 1315
滥情空心
滥情空心 2020-12-14 19:21

I have a MyTask class which implements Runnable and there can be many such objects instantiated at any given moment. There are certain properties t

4条回答
  •  借酒劲吻你
    2020-12-14 20:18

    Instead of @Autowire, use @Inject and see the magic. I have the same situation, where in, a Validator class is Java Singleton class and not spring scoped bean. I need to inject a UAA Client spring bean provided by another team. So @Autowire didn't work, but @Inject did work.

提交回复
热议问题