Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
8b199c5c
Commit
8b199c5c
authored
Jul 11, 2014
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Environment for defaulting app name and port
parent
5ee8c8c8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
12 deletions
+44
-12
README.md
README.md
+39
-0
EurekaClientAutoConfiguration.java
...latform/netflix/eureka/EurekaClientAutoConfiguration.java
+1
-0
EurekaInstanceConfigBean.java
...ork/platform/netflix/eureka/EurekaInstanceConfigBean.java
+4
-0
application.yml
src/test/resources/application.yml
+0
-12
No files found.
README.md
0 → 100644
View file @
8b199c5c
Ths project provides Netflix OSS integrations for Spring Boot apps through autoconfiguration
and binding to the Spring Environment and other Spring programming model idioms.
# Eureka Clients
Example eureka client:
```
@Configuration
@ComponentScan
@EnableAutoConfiguration
@RestController
public class Application {
@RequestMapping("/")
public String home() {
return "Hello world";
}
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class).web(true).run(args);
}
}
```
(i.e. utterly normal Spring Boot app). Configuration is required to locate the Eureka server. Example:
```
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8080/v2/
default.defaultZone: http://localhost:8080/v2/
```
The default application name, virtual host and non-secure port are taken from the
`Environment`
is
`${spring.application.name}`
,
`${spring.application.name}.mydomain.net`
and
`${server.port}`
respectively.
src/main/java/org/springframework/platform/netflix/eureka/EurekaClientAutoConfiguration.java
View file @
8b199c5c
...
@@ -38,6 +38,7 @@ public class EurekaClientAutoConfiguration implements ApplicationListener<Contex
...
@@ -38,6 +38,7 @@ public class EurekaClientAutoConfiguration implements ApplicationListener<Contex
@Autowired
@Autowired
private
EurekaClientConfigBean
clientConfig
;
private
EurekaClientConfigBean
clientConfig
;
@Autowired
@Autowired
private
EurekaInstanceConfigBean
instanceConfig
;
private
EurekaInstanceConfigBean
instanceConfig
;
...
...
src/main/java/org/springframework/platform/netflix/eureka/EurekaInstanceConfigBean.java
View file @
8b199c5c
...
@@ -27,6 +27,7 @@ import lombok.Setter;
...
@@ -27,6 +27,7 @@ import lombok.Setter;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
com.netflix.appinfo.DataCenterInfo
;
import
com.netflix.appinfo.DataCenterInfo
;
...
@@ -45,12 +46,14 @@ public class EurekaInstanceConfigBean implements EurekaInstanceConfig {
...
@@ -45,12 +46,14 @@ public class EurekaInstanceConfigBean implements EurekaInstanceConfig {
@Getter
(
AccessLevel
.
PRIVATE
)
@Setter
(
AccessLevel
.
PRIVATE
)
@Getter
(
AccessLevel
.
PRIVATE
)
@Setter
(
AccessLevel
.
PRIVATE
)
private
String
[]
hostInfo
=
initHostInfo
();
private
String
[]
hostInfo
=
initHostInfo
();
@Value
(
"${spring.application.name:unkown}"
)
private
String
appname
=
"unknown"
;
private
String
appname
=
"unknown"
;
private
String
appGroupName
;
private
String
appGroupName
;
private
boolean
instanceEnabledOnit
;
private
boolean
instanceEnabledOnit
;
@Value
(
"${server.port:80}"
)
private
int
nonSecurePort
=
80
;
private
int
nonSecurePort
=
80
;
private
int
securePort
=
443
;
private
int
securePort
=
443
;
...
@@ -63,6 +66,7 @@ public class EurekaInstanceConfigBean implements EurekaInstanceConfig {
...
@@ -63,6 +66,7 @@ public class EurekaInstanceConfigBean implements EurekaInstanceConfig {
private
int
leaseExpirationDurationInSeconds
=
90
;
private
int
leaseExpirationDurationInSeconds
=
90
;
@Value
(
"${spring.application.name:unkown}.mydomain.net"
)
private
String
virtualHostName
;
private
String
virtualHostName
;
private
String
secureVirtualHostName
;
private
String
secureVirtualHostName
;
...
...
src/test/resources/application.yml
View file @
8b199c5c
...
@@ -8,14 +8,3 @@ eureka:
...
@@ -8,14 +8,3 @@ eureka:
serviceUrl
:
serviceUrl
:
defaultZone
:
http://localhost:8080/v2/
defaultZone
:
http://localhost:8080/v2/
default.defaultZone
:
http://localhost:8080/v2/
default.defaultZone
:
http://localhost:8080/v2/
region
:
default
availabilityZones
:
us-east-1
:
default
preferSameZoneEureka
:
true
useDnsForFetchingServiceUrls
:
false
instance
:
nonSecurePort
:
${server.port}
appname
:
${spring.application.name}
virtualHostName
:
${spring.application.name}.mydomain.net
statusPageUrlPath
:
/info
healthCheckUrlPath
:
/health
\ 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