spring boot 注入 jar 包中的接口总是提示 that could not be found

首先是在 spring boot 项目中注入的 jar 包中的接口

public class MessageTransferStationController {

    private MessageClient messageClient;

其次,jar 包中的 MessageClient 的源码

public interface MessageClient {

MessageClient 分别有三个实现类

public class CoreMessageClient implements MessageClient {}

public class SpringMessageClientImpl extends CoreMessageClient implements MessageClient {}

public class Spring2MessageClientImpl extends CoreMessageClient implements MessageClient {}

当我在 spring boot 项目中注入 MessageClient 接口的时候,启动报错:

017-06-12 15:06:53.281 WARN 9780 — [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘messageTransferStationController’: Unsatisfied dependency expressed through field ‘messageClient’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.sinosoft.messageclient.MessageClient’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2017-06-12 15:06:53.283 INFO 9780 — [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2017-06-12 15:06:53.316 INFO 9780 — [ main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report re-run your application with ‘debug’ enabled.
2017-06-12 15:06:53.431 ERROR 9780 — [ main] o.s.b.d.LoggingFailureAnalysisReporter :



Field messageClient in com.sinosoft.oa.messagetransferstation.web.MessageTransferStationController required a bean of type ‘com.sinosoft.messageclient.MessageClient’ that could not be found.


Consider defining a bean of type ‘com.sinosoft.messageclient.MessageClient’ in your configuration.

Process finished with exit code 1

请问各位大佬,为什么 MessageClient 为什么不能注入,我猜想过 MessageClient 的实现类没有被 Spring 管理,我看了 jar 包中源码有一个实现类加上了 @Component 注解


注:引用 jar 包中的其它接口也测试过了,同样的错误,也就是说引用的这个 jar 包中的所有接口都没有被 spring 管理,或者没有扫描。