@Autowired没有在春季启动工作

时间:2017-07-07 04:56:17

标签: spring-boot autowired spring-restcontroller

我正在开发spring-boot应用程序。在该应用程序中,@Autowired不适用于某些类。

我在spring boot应用程序中有以下类:

@Component
public class SessionUser {
    private static final String SESSION_PRINCIPAL = "session.principal";

    @Autowired
    private HttpSession httpSession;

    //more code
}


@RestController
public class RefreshUserPermissionsRequestHandler {
    @Autowired
    TaskTrigger taskTrigger;

    @Autowired
    private SessionUser sessionUser;

}

public class LocalFileUserProviderImpl {
    @Autowired
    private SessionUser sessionUser;

    //more code 
}

RefreshUserPermissionsRequestHandler中,SessionUser bean正在正常注入,但在LocalFileUserProviderImpl中它无法正常工作。即使我尝试使用LocalFileUserProviderImpl@RestController注释@Controller,但两者都无效。

任何人都可以帮我解决这里出了什么问题吗?如果需要进一步的信息,请告诉我。

0 个答案:

没有答案
相关问题