@ComponentScan({"com.xia.blog.client"}) //被扫描的包 可以有注解@Service @Dao 等
@EnableFeignClients({"com.xia.blog.client"})
public class MyConfiguration {
}
在resources/META-INF/spring.factories文件中加入
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.xia.blog.client.MyConfiguration
该模块的pom
<build>
<resources>
<!--打包代码文件夹内所有文件-->
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.factories</include>
<include>**/*.yml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
</plugins>
</build>
com.xia.blog.client包的类在其他应用中被自动注入到Spring容器中
标签:xia,Spring,boot,blog,client,模块,com From: https://www.cnblogs.com/xiamingqing/p/18033793