Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
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
DEMO
spring-boot
Commits
17de6689
Commit
17de6689
authored
Nov 17, 2013
by
Dave Syer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENsure Vcap initializer runs before config file parser
Fixes gh-119.
parent
2f721400
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
VcapApplicationContextInitializer.java
...ontext/initializer/VcapApplicationContextInitializer.java
+9
-3
No files found.
spring-boot/src/main/java/org/springframework/boot/context/initializer/VcapApplicationContextInitializer.java
View file @
17de6689
...
@@ -63,7 +63,7 @@ import org.springframework.util.StringUtils;
...
@@ -63,7 +63,7 @@ import org.springframework.util.StringUtils;
* to <code>vcap.application.*</code> in a fairly obvious way, and the VCAP_SERVICES
* to <code>vcap.application.*</code> in a fairly obvious way, and the VCAP_SERVICES
* object is unwrapped so that it is a hash of objects with key equal to the service
* object is unwrapped so that it is a hash of objects with key equal to the service
* instance name (e.g. "mysql" in the example above), and value equal to that instances
* instance name (e.g. "mysql" in the example above), and value equal to that instances
* properties, and then flattened in the s
ma
e way. E.g.
* properties, and then flattened in the s
am
e way. E.g.
*
*
* <pre>
* <pre>
* vcap.application.instance_id: 2ce0ac627a6c8e47e936d829a3a47b5b
* vcap.application.instance_id: 2ce0ac627a6c8e47e936d829a3a47b5b
...
@@ -81,6 +81,10 @@ import org.springframework.util.StringUtils;
...
@@ -81,6 +81,10 @@ import org.springframework.util.StringUtils;
* ...
* ...
* </pre>
* </pre>
*
*
* N.B. this initializer is mainly intended for informational use (the application and
* instance ids are particularly useful). For service binding you might find that Spring
* Cloud is more convenient and more robust against potential changes in Cloud Foundry.
*
* @author Dave Syer
* @author Dave Syer
*/
*/
public
class
VcapApplicationContextInitializer
implements
public
class
VcapApplicationContextInitializer
implements
...
@@ -93,7 +97,9 @@ public class VcapApplicationContextInitializer implements
...
@@ -93,7 +97,9 @@ public class VcapApplicationContextInitializer implements
private
static
final
String
VCAP_SERVICES
=
"VCAP_SERVICES"
;
private
static
final
String
VCAP_SERVICES
=
"VCAP_SERVICES"
;
private
int
order
=
Integer
.
MIN_VALUE
+
11
;
// Intentionally before ConfigFileApplicationContextInitializer so values there can
// use these ones
private
int
order
=
Integer
.
MIN_VALUE
+
9
;
private
JsonParser
parser
=
JsonParserFactory
.
getJsonParser
();
private
JsonParser
parser
=
JsonParserFactory
.
getJsonParser
();
...
@@ -188,7 +194,7 @@ public class VcapApplicationContextInitializer implements
...
@@ -188,7 +194,7 @@ public class VcapApplicationContextInitializer implements
}
}
}
}
catch
(
Exception
ex
)
{
catch
(
Exception
ex
)
{
logger
.
error
(
"Could not parse VCAP_
APPLICATION
"
,
ex
);
logger
.
error
(
"Could not parse VCAP_
SERVICES
"
,
ex
);
}
}
return
properties
;
return
properties
;
}
}
...
...
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