2014-12-02 136 views
0

UserProfileService領域實現AuthenticationProvider類聲明,如下所示:如何解決未解決的UserProfileService?

public class AdAuthenticationController implements AuthenticationProvider { 

    private UserProfileService userProfileService; 
} 

不知有錯誤提UserProfileService cannot be resolved to a type。我正在使用Spring Security 3.1.3版本,對此錯誤提供任何線索?

+0

它在類路徑中嗎?你輸入了嗎? – holmis83 2014-12-02 10:13:34

+0

@ holmis83是的。它是。 – huahsin68 2014-12-04 10:37:28

回答

0

我懷疑缺少Spring註釋@Autowired,它將這個服務注入到Controller中。試試這個:

public class AdAuthenticationController implements AuthenticationProvider { 

    @Autowired 
    private UserProfileService userProfileService; 
} 
+0

這不適合我。 – huahsin68 2014-12-04 10:36:48