Kaynağa Gözat

调整feign 扫描路径

wuxw 7 yıl önce
ebeveyn
işleme
266a75adb0

+ 7 - 4
Api/src/main/java/com/java110/api/ApiApplicationStart.java

@@ -37,19 +37,20 @@ import java.nio.charset.Charset;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication(scanBasePackages={"com.java110.service","com.java110.api","com.java110.core","com.java110.event.service.api","com.java110.cache"})
+@SpringBootApplication(scanBasePackages = {"com.java110.service", "com.java110.api", "com.java110.core", "com.java110.event.service.api", "com.java110.cache"})
 @EnableDiscoveryClient
 @Java110ListenerDiscovery(listenerPublishClass = ServiceDataFlowEventPublishing.class,
         basePackages = {"com.java110.api.listener"})
 @EnableSwagger2
 //@EnableConfigurationProperties(EventProperties.class)
-@EnableFeignClients(basePackages={"com.java110.core.smo"})
+@EnableFeignClients(basePackages = {"com.java110.core.smo"})
 public class ApiApplicationStart {
 
-    private final static Logger logger = LoggerFactory.getLogger(ApiApplicationStart.class);
+    private static Logger logger = LoggerFactory.getLogger(ApiApplicationStart.class);
 
     /**
      * 实例化RestTemplate,通过@LoadBalanced注解开启均衡负载能力.
+     *
      * @return restTemplate
      */
     @Bean
@@ -62,6 +63,7 @@ public class ApiApplicationStart {
 
     /**
      * 实例化RestTemplate
+     *
      * @return restTemplate
      */
     @Bean
@@ -83,6 +85,7 @@ public class ApiApplicationStart {
     /**
      * 创建该API的基本信息(这些基本信息会展现在文档页面中)
      * 访问地址:http://项目实际地址/swagger-ui.html
+     *
      * @return
      */
     private ApiInfo apiInfo() {
@@ -96,7 +99,7 @@ public class ApiApplicationStart {
     }
 
 
-    public static void main(String[] args) throws Exception{
+    public static void main(String[] args) throws Exception {
         ApplicationContext context = SpringApplication.run(ApiApplicationStart.class, args);
 
         //服务启动加载

+ 5 - 4
CommunityService/src/main/java/com/java110/community/CommunityServiceApplicationStart.java

@@ -28,18 +28,19 @@ import java.nio.charset.Charset;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication(scanBasePackages={"com.java110.service","com.java110.community","com.java110.core","com.java110.cache"})
+@SpringBootApplication(scanBasePackages = {"com.java110.service", "com.java110.community", "com.java110.core", "com.java110.cache"})
 @EnableDiscoveryClient
 @Java110ListenerDiscovery(listenerPublishClass = BusinessServiceDataFlowEventPublishing.class,
         basePackages = {"com.java110.community.listener"})
-@EnableFeignClients(basePackages = {"com.java110.core.smo"})
+@EnableFeignClients(basePackages = {"com.java110.core.smo.user"})
 public class CommunityServiceApplicationStart {
 
-    private final static Logger logger = LoggerFactory.getLogger(CommunityServiceApplicationStart.class);
+    private static Logger logger = LoggerFactory.getLogger(CommunityServiceApplicationStart.class);
 
 
     /**
      * 实例化RestTemplate,通过@LoadBalanced注解开启均衡负载能力.
+     *
      * @return restTemplate
      */
     @Bean
@@ -50,7 +51,7 @@ public class CommunityServiceApplicationStart {
         return restTemplate;
     }
 
-    public static void main(String[] args) throws Exception{
+    public static void main(String[] args) throws Exception {
         ApplicationContext context = SpringApplication.run(CommunityServiceApplicationStart.class, args);
         ServiceStartInit.initSystemConfig(context);
     }

+ 5 - 2
UserService/src/main/java/com/java110/user/UserServiceApplicationStart.java

@@ -36,11 +36,14 @@ import java.nio.charset.Charset;
  * @date 2016年8月6日
  * @tag
  */
-@SpringBootApplication(scanBasePackages = {"com.java110.service", "com.java110.user", "com.java110.core", "com.java110.cache"})
+@SpringBootApplication(
+        scanBasePackages = {"com.java110.service", "com.java110.user", "com.java110.core", "com.java110.cache"},
+        excludeName = {"com.java110.core.smo.user"}
+        )
 @EnableDiscoveryClient
 @Java110ListenerDiscovery(listenerPublishClass = BusinessServiceDataFlowEventPublishing.class,
         basePackages = {"com.java110.user.listener"})
-@EnableFeignClients(basePackages = {"com.java110.core.smo"})
+//@EnableFeignClients(basePackages = {"com.java110.core.smo"})
 public class UserServiceApplicationStart {
 
     private static Logger logger = LoggerFactory.getLogger(UserServiceApplicationStart.class);