优化公共starter的bean加载方式,避免依赖的工程因包路径不一致而导致加载不了的情况
This commit is contained in:
+3
-2
@@ -1,5 +1,6 @@
|
||||
package com.central.search.annotation;
|
||||
|
||||
import com.central.search.client.feign.fallback.SearchServiceFallbackFactory;
|
||||
import com.central.search.client.service.impl.QueryServiceImpl;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Import;
|
||||
@@ -16,8 +17,8 @@ import java.lang.annotation.Target;
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@EnableFeignClients
|
||||
@Import(QueryServiceImpl.class)
|
||||
@EnableFeignClients(basePackages = "com.central")
|
||||
@Import({SearchServiceFallbackFactory.class, QueryServiceImpl.class})
|
||||
public @interface EnableSearchClient {
|
||||
|
||||
}
|
||||
|
||||
-2
@@ -5,7 +5,6 @@ import com.central.common.model.PageResult;
|
||||
import com.central.search.client.feign.SearchService;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* searchService降级工场
|
||||
@@ -13,7 +12,6 @@ import org.springframework.stereotype.Component;
|
||||
* @author zlt
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class SearchServiceFallbackFactory implements FallbackFactory<SearchService> {
|
||||
@Override
|
||||
public SearchService create(Throwable throwable) {
|
||||
|
||||
Reference in New Issue
Block a user