Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈文顺
discovery
Commits
0000ecdb
Commit
0000ecdb
authored
Jul 03, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加Feign配置
parent
c893b768
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
28 deletions
+22
-28
discovery-springcloud-example/src/main/java/com/nepxion/discovery/plugin/example/feign/FeignBeanFactoryPostProcessor.java
+0
-25
discovery-springcloud-example/src/main/java/com/nepxion/discovery/plugin/example/feign/FeignConfiguration.java
+22
-3
No files found.
discovery-springcloud-example/src/main/java/com/nepxion/discovery/plugin/example/feign/FeignBeanFactoryPostProcessor.java
deleted
100644 → 0
View file @
c893b768
package
com
.
nepxion
.
discovery
.
plugin
.
example
.
feign
;
/**
* <p>Title: Nepxion Discovery</p>
* <p>Description: Nepxion Discovery</p>
* <p>Copyright: Copyright (c) 2017-2050</p>
* <p>Company: Nepxion</p>
* @author Haojun Ren
* @version 1.0
*/
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.BeanFactoryPostProcessor
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
// 参考:https://github.com/spring-cloud/spring-cloud-netflix/issues/1952, https://github.com/spring-cloud/spring-cloud-netflix/issues/1064
public
class
FeignBeanFactoryPostProcessor
implements
BeanFactoryPostProcessor
{
@Override
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
BeanDefinition
definition
=
beanFactory
.
getBeanDefinition
(
"feignContext"
);
definition
.
setDependsOn
(
"eurekaServiceRegistry"
,
"inetUtils"
);
}
}
\ No newline at end of file
discovery-springcloud-example/src/main/java/com/nepxion/discovery/plugin/example/feign/FeignConfiguration.java
View file @
0000ecdb
...
@@ -9,13 +9,31 @@ package com.nepxion.discovery.plugin.example.feign;
...
@@ -9,13 +9,31 @@ package com.nepxion.discovery.plugin.example.feign;
* @version 1.0
* @version 1.0
*/
*/
import
org.springframework.beans.BeansException
;
import
org.springframework.beans.factory.config.BeanDefinition
;
import
org.springframework.beans.factory.config.BeanFactoryPostProcessor
;
import
org.springframework.beans.factory.config.ConfigurableListableBeanFactory
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
@Configuration
public
class
FeignConfiguration
{
public
class
FeignConfiguration
{
@Bean
// 该Issue只在Eureka下才会出现
public
FeignBeanFactoryPostProcessor
feignBeanFactoryPostProcessor
()
{
@ConditionalOnClass
(
name
=
"org.springframework.cloud.netflix.eureka.serviceregistry.EurekaServiceRegistry"
)
return
new
FeignBeanFactoryPostProcessor
();
protected
static
class
FeignBeanFactoryPostProcessorConfiguration
{
@Bean
public
BeanFactoryPostProcessor
feignBeanFactoryPostProcessor
()
{
return
new
FeignBeanFactoryPostProcessor
();
}
}
// 参考:https://github.com/spring-cloud/spring-cloud-netflix/issues/1952, https://github.com/spring-cloud/spring-cloud-netflix/issues/1064
protected
static
class
FeignBeanFactoryPostProcessor
implements
BeanFactoryPostProcessor
{
@Override
public
void
postProcessBeanFactory
(
ConfigurableListableBeanFactory
beanFactory
)
throws
BeansException
{
BeanDefinition
definition
=
beanFactory
.
getBeanDefinition
(
"feignContext"
);
definition
.
setDependsOn
(
"eurekaServiceRegistry"
,
"inetUtils"
);
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment