@Autowired objects getting null value

后端 未结 6 1920
情话喂你
情话喂你 2021-01-12 04:29

Trying to set up a project but fail at Autowiring objects through Spring.

package se.hsr.web;

public class TestRunner {

    public static void main(String[         


        
6条回答
  •  爱一瞬间的悲伤
    2021-01-12 04:54

    you are creating the POJO outside of the spring context.

    if you really want to be able to instanciate "manually", you can fix this, by adding to your configuration, and then annotating ContactDAOImpl with @Configurable

提交回复
热议问题