These are chat archives for spring-cloud/spring-cloud

7th
Sep 2016
Andrew Fitzgerald
@fitzoh
Sep 07 2016 02:19
Can’t reproduce it in a smaller app… ¯_(ツ)_/¯
nevermind!
Spencer Gibb
@spencergibb
Sep 07 2016 02:28
:stuck_out_tongue_winking_eye:
dragontree101
@dragontree101
Sep 07 2016 08:02
can i get git's config from event in
@Override
  public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {

}
i want to get config from git in spring boot's
ApplicationListener<ApplicationEnvironmentPreparedEvent> interface
does any method to get? thanks
Dave Syer
@dsyer
Sep 07 2016 08:05
What do you mean by "git's config"?
You mean $HOME/.git/config?
dragontree101
@dragontree101
Sep 07 2016 08:05
no
my lots of config in gitlab, and i get config from spring-cloud-client
Dave Syer
@dsyer
Sep 07 2016 08:07
Then you already get it from the config server via the spring-cloud-client.
What else do you want, and why?
dragontree101
@dragontree101
Sep 07 2016 08:09

i have some spring-boot listener, likes

public class LoggerListener implements ApplicationListener<ApplicationEnvironmentPreparedEvent>

and i want to get config in

@Override
  public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) {
}
i want to get config in onApplicationEvent and to init some other state
Dave Syer
@dsyer
Sep 07 2016 08:10
That event is too early then
It says the Environment is prepared. Not that it is fully loaded.
dragontree101
@dragontree101
Sep 07 2016 08:11
so i can't use this way ?
Dave Syer
@dsyer
Sep 07 2016 08:11
It depends what you are trying to do
The application context isn't even created at that point
dragontree101
@dragontree101
Sep 07 2016 08:13
does spring-cloud-config have callback method when get config from spring-cloud-server?
Dave Syer
@dsyer
Sep 07 2016 08:13
Not specifically, no
But clearly it is there at some point, and you can access it in the Environment
What do you need to do with it, is really the question?
Why can't you just consume it as you normally would the Environment?
dragontree101
@dragontree101
Sep 07 2016 08:16
i want to get some on/off flag as early as possible, so i want to get in ApplicationEnvironmentPreparedEvent
Dave Syer
@dsyer
Sep 07 2016 08:16
Well that's way too early, like I said.
Why do you need it?
dragontree101
@dragontree101
Sep 07 2016 08:21
yes , in my way it too early, i will change my way to get this config
Dave Syer
@dsyer
Sep 07 2016 08:23
I think it would be better to change how you use it
but that's your choice
dragontree101
@dragontree101
Sep 07 2016 08:27
thanks very much, i will to change my way