我如何解决未解决的UserProfileService?

时间:2014-12-02 07:58:59

标签: spring-security

我在实现UserProfileService的类中声明AuthenticationProvider字段,如下所示:

public class AdAuthenticationController implements AuthenticationProvider {

   private UserProfileService userProfileService;
}

不知何故提到错误UserProfileService cannot be resolved to a type。我正在使用Spring Security 3.1.3版,这个错误的任何线索?

1 个答案:

答案 0 :(得分:0)

我怀疑缺少Spring注释@Autowired将此服务注入Controller。试试这个:

public class AdAuthenticationController implements AuthenticationProvider {

   @Autowired
   private UserProfileService userProfileService;
}