-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Client spring integration #543
Client spring integration #543
Conversation
Codecov Report
@@ Coverage Diff @@
## master #543 +/- ##
============================================
+ Coverage 46.32% 46.83% +0.51%
- Complexity 1306 1340 +34
============================================
Files 312 319 +7
Lines 8469 8575 +106
Branches 814 824 +10
============================================
+ Hits 3923 4016 +93
- Misses 4263 4276 +13
Partials 283 283
Continue to review full report at Codecov.
|
May I ask you a question? 可以问一个问题吗? |
defaultConfig.getProperty(someKey, new Function<String, String>() {
@Override
public String apply(String s) {
DecryptRequest request = new DecryptRequest();
request.setEncryptedText(s);
return HttpEncryptionWrapper.decrypt(request);
}
}, "defaultValue"); I am ready implement by AbstractConfig.getProperty(String key, Function<String, T> function, T defaultValue); |
Currently there is no hook to support this feature, I think apollo-client should provide such capability in the future. |
I hook it with overwrite some classes. DefaultInjector -> XXXInjector
DefaultConfigManager -> XXXConfigManager
DefaultConfigFactoryManager -> XXXConfigFactoryManager
DefaultConfigRegistry -> XXXConfigRegistry
DefaultConfigFactory -> XXXConfigFactory
DefaultConfig -> XXXConfig overwrite file: Is that the right way to overwrite Default behavior? |
How to overwrite apollo default behavior and add decode function(define customer apollo client)?
{XXX}Injector implements Injector
{XXX}ConfigFactory implements ConfigFactory
{XXX}Config extends AbstractConfig implements RepositoryChangeListener step 2. overwrite file: PS:app server nothing have to modified.
{XXX}PropertySourcesPlaceholderConfigurer extends PropertySourcesPlaceholderConfigurer step 2. define class {XXX}ApolloConfigRegistrar implements ImportBeanDefinitionRegistrar step 3. define customer annotation: @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Import({XXX}ApolloConfigRegistrar.class)
public @interface Enable{XXX}ApolloConfig {
String[] value() default {ConfigConsts.NAMESPACE_APPLICATION};
int order() default Ordered.HIGHEST_PRECEDENCE;
} step 4(PS). use @enable{XXX}ApolloConfig instead of @EnableApolloConfig in app server. |
Apollo Client Integration With Spring.
Features
The following features are now provided:
1. Spring Property Placeholder Support
1.1 XML Placeholder
1.2 @value Placeholder
2. Spring Annotation Support
Configuration
Apollo supports both the traditional XML based configuration and moden Java based configuration.
1. XML Based Configuration Example
2. Java Based Configuration Example