得到错误
No matching bean of type [foo.bar.service.AccountService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
我的服务:
public interface AccountService {
@Service
public class AccountServiceImpl implements AccountService {
所以我应该得到实施
我想在哪里得到它:
public class CustomAuthentication implements AuthenticationProvider {
@Autowired
private AccountService accountService;
在我的其他班级也做同样的事情,但它在那里工作。
@Controller
public class AccountController {
@Autowired
private AccountService accountService;
当我从我的 中删除这 2 行时CustomAuthentication
,没有错误。
配置以防万一:
<context:component-scan base-package="foo.bar" />