-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to use custom RestTemplate in config-client #501
Comments
There is some discussion in #177 |
Specifically #177 (comment) |
I am following same steps as mentioned in #177, but I am getting below error. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configSourceLocator': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [packagename.ConfigSourceLocator$$EnhancerBySpringCGLIB$$108293a2]: No default constructor found; nested exception is java.lang.NoSuchMethodException: packagename.ConfigSourceLocator$$EnhancerBySpringCGLIB$$108293a2.() It seems that it is looking for default constructor. Is there any way to force to execute args constructor by skipping default one? Below is my code
|
After removing @order(0) and @configuration annotation Its work for me. |
I am able to customize restTemplate object by following step mentioned in #177. Here, three beans are created for ConfigServicePropertySourceLocator and therefore three calls are made for connecting config-server(Highlighted below). I have mentioned @primary in my code so its give priorities to it and its work fine. So my only concern is that Is this the best way to customize restTemplate or I miss something? 2016-09-29 19:27:26.599 INFO 14156 --- [ restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: https://localhost:9443 |
Is there any way to use custom RestTemplate object that is used in config-client?
The reason why I need this is that we are working in distributed system. So if we would like to connect some https application then we are creating restTemplate with ClientHttpRequestFactory. Within ClientHttpRequestFactory we are setting sslConnectionSocketFactory property in such a way that we don't need to do deal with installing trust store etc.
In normal applicatin it works fine, but Now we are moving config-server to https, So to connect with it config-client use RestTemplate object and that is generated within config-client.
I want a some way that config-client use restTemplate object that is generated by me.
The text was updated successfully, but these errors were encountered: