Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException

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: {} 解决:java

@Component
public class TaskProperties {
	public TaskProperties(ResourceBundle resourceBundle) {

TaskProperties是component,构造方法入参有ResourceBundle,但ResourceBundle不是component致使。 把TaskProperties设置为不是@Component。spring

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)}

解决:ui

@Autowired
SftpConnectCommand sftpConnectCommand;

@Component
public interface Command {

解决:接口为@Component不行,须要实现类为@Compoenent。 增长:.net

@Component
public class SftpConnectCommand implements Command {

public interface TaskCommandInvoker {

@Component
public class DefaultTaskCommandInvoker implements TaskCommandInvoker {

@Autowired
TaskCommandInvoker taskCommandInvoker;

interface不须要@Component,也能够注入。code

相关文章
相关标签/搜索