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

相關文章
相關標籤/搜索