forked from Netflix/eureka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add missing client side filters - clean up interfaces to be standardising on javax.wx.rs - added README
- Loading branch information
1 parent
f2671f0
commit 944378a
Showing
24 changed files
with
326 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
This is work in progress. DiscoveryClient has hard dependency on Jersey 1.x, and it must be removed first | ||
before Jersey 2.x transport can be injected. | ||
Please note that this jersey2 compatible Eureka client (eureka-client-jersey2) is created and maintained by the community. Netflix does not currently use this library internally. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
eureka-client-jersey2/src/main/java/com/netflix/discovery/guice/Jersey2EurekaModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.netflix.discovery.guice; | ||
|
||
import com.google.inject.AbstractModule; | ||
import com.google.inject.Provides; | ||
import com.google.inject.Scopes; | ||
import com.netflix.appinfo.ApplicationInfoManager; | ||
import com.netflix.appinfo.EurekaInstanceConfig; | ||
import com.netflix.appinfo.InstanceInfo; | ||
import com.netflix.appinfo.providers.CloudInstanceConfigProvider; | ||
import com.netflix.appinfo.providers.EurekaConfigBasedInstanceInfoProvider; | ||
import com.netflix.discovery.AbstractDiscoveryClientOptionalArgs; | ||
import com.netflix.discovery.DiscoveryClient; | ||
import com.netflix.discovery.EurekaClient; | ||
import com.netflix.discovery.EurekaClientConfig; | ||
import com.netflix.discovery.Jersey2DiscoveryClientOptionalArgs; | ||
import com.netflix.discovery.providers.DefaultEurekaClientConfigProvider; | ||
import com.netflix.discovery.shared.transport.jersey.TransportClientFactories; | ||
import com.netflix.discovery.shared.transport.jersey2.Jersey2TransportClientFactories; | ||
|
||
/** | ||
* @author David Liu | ||
*/ | ||
public final class Jersey2EurekaModule extends AbstractModule { | ||
@Override | ||
protected void configure() { | ||
// need to eagerly initialize | ||
bind(ApplicationInfoManager.class).asEagerSingleton(); | ||
|
||
// | ||
// override these in additional modules if necessary with Modules.override() | ||
// | ||
|
||
bind(EurekaInstanceConfig.class).toProvider(CloudInstanceConfigProvider.class).in(Scopes.SINGLETON); | ||
bind(EurekaClientConfig.class).toProvider(DefaultEurekaClientConfigProvider.class).in(Scopes.SINGLETON); | ||
|
||
// this is the self instanceInfo used for registration purposes | ||
bind(InstanceInfo.class).toProvider(EurekaConfigBasedInstanceInfoProvider.class).in(Scopes.SINGLETON); | ||
|
||
bind(EurekaClient.class).to(DiscoveryClient.class).in(Scopes.SINGLETON); | ||
|
||
// jersey2 support bindings | ||
bind(AbstractDiscoveryClientOptionalArgs.class).to(Jersey2DiscoveryClientOptionalArgs.class).in(Scopes.SINGLETON); | ||
} | ||
|
||
@Provides | ||
public TransportClientFactories getTransportClientFactories() { | ||
return Jersey2TransportClientFactories.getInstance(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) { | ||
return obj != null && getClass().equals(obj.getClass()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return getClass().hashCode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.