一
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'java.util.ResourceBundle' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {} 解决:
@Component
public class TaskProperties {
public TaskProperties(ResourceBundle resourceBundle) {
TaskProperties是component,构造方法入参有ResourceBundle,但ResourceBundle不是component导致。 把TaskProperties设置为不是@Component。
二
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException:
No qualifying bean of type 'com..transfer.ftp2.SftpConnectCommand' available:
expected at least 1 bean which qualifies as autowire candidate. Dependency annotations:
{@org.springframework.beans.factory.annotation.Autowired(required=true)}
解决:
@Autowired
SftpConnectCommand sftpConnectCommand;
@Component
public interface Command {
解决:接口为@Component不行,需要实现类为@Compoenent。 增加:
@Component
public class SftpConnectCommand implements Command {
三
public interface TaskCommandInvoker {
@Component
public class DefaultTaskCommandInvoker implements TaskCommandInvoker {
@Autowired
TaskCommandInvoker taskCommandInvoker;
interface不需要@Component,也可以注入。