Spring security 如何解决未解析的UserProfileService?

Spring security 如何解决未解析的UserProfileService?,spring-security,Spring Security,我在一个类中声明了UserProfileService字段,该类实现了AuthenticationProvider,如下所示: public class AdAuthenticationController implements AuthenticationProvider { private UserProfileService userProfileService; } 不知何故,出现了一个错误,即无法将用户档案服务解析为类型。我使用的是Spring Security版本3.1.3

我在一个类中声明了
UserProfileService
字段,该类实现了
AuthenticationProvider
,如下所示:

public class AdAuthenticationController implements AuthenticationProvider {

   private UserProfileService userProfileService;
}

不知何故,出现了一个错误,即无法将用户档案服务解析为类型。我使用的是Spring Security版本3.1.3,有没有关于此错误的线索?

我怀疑缺少将此服务注入控制器的Spring annotation@Autowired。试试这个:

public class AdAuthenticationController implements AuthenticationProvider {

   @Autowired
   private UserProfileService userProfileService;
}

它在类路径中吗?你进口了吗?@holmis83是的。它是。