Reference: https://github.com/ctripcorp/apollo/wiki/Apollo%E5%BC%80%E5%8F%91%E6%8C%87%E5%8D%97#23-java%E6%A0%B7%E4%BE% 8b%e5%ae%a2%e6%88%b7%e7%ab%af%e5%90%af%e5%8a%a8
The premise is to build a local machine environment first: http://www.cnblogs.com/EasonJim/p/7643630.html
Unzip import Eclipse:
The main use is Apollo-demo
Create a new app and profile entry in the configuration center background
Note: In the name of the two profiles, the first one is the default when you create a new app, and the key is to fill it in. The second option is to specify private mode when adding namespace to enter a custom name.
Go back to the Apollo-demo project and specify class to run, adding the following VM boot parameters:
After startup, you can see that the following information has been started remotely:
Why you need to pass two VM parameters for the following reasons:
1, the first parameter is used to specify the environment, env first through the/opt/settings/server.propertis specified to read, if not directly read the system Properties-D provided, if not, then you hang up.
2, because the use of the full set of code introduced to the demo project, so in the App-core for the Meta_server address takes the variable to read, and this variable provides the way the system attribute-D to provide. Over here:
And if you are using your own package to upload to the warehouse client, the client will eventually contain the core, these addresses are automatically specified, so no system attributes are required.
Java sample client startup and debugging in the Ctrip Apollo (Apollo) configuration Center