Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wrr-cat
apollo
提交
49b27bd0
apollo
项目概览
wrr-cat
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
49b27bd0
编写于
4月 04, 2018
作者:
W
wiston1988
提交者:
GitHub
4月 04, 2018
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3 from ctripcorp/master
new version
上级
72a37b66
d6b4ff82
变更
31
隐藏空白更改
内联
并排
Showing
31 changed file
with
211 addition
and
81 deletion
+211
-81
.travis.yml
.travis.yml
+3
-3
README.md
README.md
+1
-0
apollo-adminservice/pom.xml
apollo-adminservice/pom.xml
+1
-1
apollo-adminservice/src/main/docker/Dockerfile
apollo-adminservice/src/main/docker/Dockerfile
+1
-1
apollo-assembly/pom.xml
apollo-assembly/pom.xml
+1
-1
apollo-biz/pom.xml
apollo-biz/pom.xml
+1
-1
apollo-buildtools/pom.xml
apollo-buildtools/pom.xml
+1
-1
apollo-client/README.md
apollo-client/README.md
+1
-1
apollo-client/pom.xml
apollo-client/pom.xml
+1
-1
apollo-client/src/main/java/com/ctrip/framework/apollo/build/ApolloInjector.java
...java/com/ctrip/framework/apollo/build/ApolloInjector.java
+1
-1
apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultInjector.java
...com/ctrip/framework/apollo/internals/DefaultInjector.java
+0
-6
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/annotation/ApolloJsonValueProcessor.java
...rk/apollo/spring/annotation/ApolloJsonValueProcessor.java
+3
-2
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/annotation/SpringValueProcessor.java
...mework/apollo/spring/annotation/SpringValueProcessor.java
+3
-2
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/boot/ApolloApplicationContextInitializer.java
...ollo/spring/boot/ApolloApplicationContextInitializer.java
+2
-1
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/config/PropertySourcesProcessor.java
...mework/apollo/spring/config/PropertySourcesProcessor.java
+2
-1
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/AutoUpdateConfigChangeListener.java
...pollo/spring/property/AutoUpdateConfigChangeListener.java
+23
-5
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/SpringValueDefinitionProcessor.java
...pollo/spring/property/SpringValueDefinitionProcessor.java
+2
-1
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/util/SpringInjector.java
...om/ctrip/framework/apollo/spring/util/SpringInjector.java
+53
-0
apollo-client/src/test/java/com/ctrip/framework/apollo/spring/JavaConfigPlaceholderAutoUpdateTest.java
...rk/apollo/spring/JavaConfigPlaceholderAutoUpdateTest.java
+54
-24
apollo-client/src/test/java/com/ctrip/framework/apollo/spring/XmlConfigPlaceholderAutoUpdateTest.java
...ork/apollo/spring/XmlConfigPlaceholderAutoUpdateTest.java
+46
-15
apollo-common/pom.xml
apollo-common/pom.xml
+1
-1
apollo-configservice/pom.xml
apollo-configservice/pom.xml
+1
-1
apollo-configservice/src/main/docker/Dockerfile
apollo-configservice/src/main/docker/Dockerfile
+1
-1
apollo-core/pom.xml
apollo-core/pom.xml
+1
-1
apollo-demo/pom.xml
apollo-demo/pom.xml
+1
-1
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/springBootDemo/config/SampleRedisConfig.java
.../demo/spring/springBootDemo/config/SampleRedisConfig.java
+1
-3
apollo-portal/pom.xml
apollo-portal/pom.xml
+1
-1
apollo-portal/src/main/docker/Dockerfile
apollo-portal/src/main/docker/Dockerfile
+1
-1
doc/images/known-users/enmonster.png
doc/images/known-users/enmonster.png
+0
-0
pom.xml
pom.xml
+1
-1
scripts/sql/apolloconfigdb.sql
scripts/sql/apolloconfigdb.sql
+2
-2
未找到文件。
.travis.yml
浏览文件 @
49b27bd0
...
...
@@ -24,8 +24,8 @@ branches:
env
:
global
:
-
secure
:
"
DYJkJ7ArGJuIyTJsmjvUAJRyUKXEaGFWYZFAGZq6vxbrMN3tThz7drfNhhvP2YE7hdS7YX7hZBWVQEnNR+pBN+ykQFx7TpLr311eEk2/Yy3G5qegeHMsgqYXfAp3FFpYlE6Kr3Dcf4kFSWtRi735kSo5oHicoaxbyWENgmKT+uQjYERKhDXEoenMaDpcf8WO8KARzxI1cXf69ECnYP2rzNOfkNW4IGjTcJnplXPZ9BNBRn3WfyPwEHlemETAMwJxJXolNM9qn1bDBTB/35yJrneQY/pYp9Q8PbQID2lNJu7PFKYaI9mvsKHUgxjbzsC29zlMY94pDr6sQtr7IA0dSuk+qO2tEqAStTwRI5JOcozLAslTMNnUn6HLvy0/Kkq1TL+JrIohoRD58F34SzjcnuB4w0/GCWGU4BMSbzPwHsgQZM4lkHDWv+w1OSwP3dgCFI/vYYr9xNV0zqTgyZ9ITkMZPL0wOh0DZ7Bxxm80wyHfJuRwywemMtzitgjPR4BKENbpcoGN4lcKWciksAuiyX+dedOPfGoOWfnIKh1g7yeVB84LMggCSad/9cqnYf2Sm8xSyVzNmyhSOy2Ocy40RDas2uHIK3/QPy56Le/t1LD2On/x1TZBIoSavedNYA5N54s/ZCDZOcepUMvlwtjgnx/SMjU85ZLKCcliPGdTWws="
-
"
MAVEN_OPTS=-Xms1024m
-Xmx3072m
-XX:MetaspaceSize=128m
-XX:MaxMetaspaceSize=384m"
-
secure
:
"
DYJkJ7ArGJuIyTJsmjvUAJRyUKXEaGFWYZFAGZq6vxbrMN3tThz7drfNhhvP2YE7hdS7YX7hZBWVQEnNR+pBN+ykQFx7TpLr311eEk2/Yy3G5qegeHMsgqYXfAp3FFpYlE6Kr3Dcf4kFSWtRi735kSo5oHicoaxbyWENgmKT+uQjYERKhDXEoenMaDpcf8WO8KARzxI1cXf69ECnYP2rzNOfkNW4IGjTcJnplXPZ9BNBRn3WfyPwEHlemETAMwJxJXolNM9qn1bDBTB/35yJrneQY/pYp9Q8PbQID2lNJu7PFKYaI9mvsKHUgxjbzsC29zlMY94pDr6sQtr7IA0dSuk+qO2tEqAStTwRI5JOcozLAslTMNnUn6HLvy0/Kkq1TL+JrIohoRD58F34SzjcnuB4w0/GCWGU4BMSbzPwHsgQZM4lkHDWv+w1OSwP3dgCFI/vYYr9xNV0zqTgyZ9ITkMZPL0wOh0DZ7Bxxm80wyHfJuRwywemMtzitgjPR4BKENbpcoGN4lcKWciksAuiyX+dedOPfGoOWfnIKh1g7yeVB84LMggCSad/9cqnYf2Sm8xSyVzNmyhSOy2Ocy40RDas2uHIK3/QPy56Le/t1LD2On/x1TZBIoSavedNYA5N54s/ZCDZOcepUMvlwtjgnx/SMjU85ZLKCcliPGdTWws="
-
"
MAVEN_OPTS=-Xms1024m
-Xmx3072m
-XX:MetaspaceSize=128m
-XX:MaxMetaspaceSize=384m"
addons
:
coverity_scan
:
...
...
@@ -39,4 +39,4 @@ addons:
cache
:
directories
:
-
$HOME/.m2
-
$HOME/.m2
README.md
浏览文件 @
49b27bd0
...
...
@@ -155,3 +155,4 @@ The project is licensed under the [Apache 2 license](https://github.com/ctripcor
![
蘑菇租房
](
https://github.com/ctripcorp/apollo/blob/master/doc/images/known-users/mgzf.png
)
![
狐狸金服
](
https://github.com/ctripcorp/apollo/blob/master/doc/images/known-users/huli-logo.png
)
![
漫道集团
](
https://github.com/ctripcorp/apollo/blob/master/doc/images/known-users/mandao.png
)
![
怪兽充电
](
https://github.com/ctripcorp/apollo/blob/master/doc/images/known-users/enmonster.png
)
apollo-adminservice/pom.xml
浏览文件 @
49b27bd0
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-adminservice/src/main/docker/Dockerfile
浏览文件 @
49b27bd0
...
...
@@ -7,7 +7,7 @@
FROM
openjdk:8-jre-alpine
MAINTAINER
ameizi <sxyx2008@163.com>
ENV
VERSION 0.10.
0-SNAPSHOT
ENV
VERSION 0.10.
2
RUN
echo
"http://mirrors.aliyun.com/alpine/v3.6/main"
>
/etc/apk/repositories
\
&&
echo
"http://mirrors.aliyun.com/alpine/v3.6/community"
>>
/etc/apk/repositories
\
...
...
apollo-assembly/pom.xml
浏览文件 @
49b27bd0
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-biz/pom.xml
浏览文件 @
49b27bd0
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-biz
</artifactId>
...
...
apollo-buildtools/pom.xml
浏览文件 @
49b27bd0
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-client/README.md
浏览文件 @
49b27bd0
...
...
@@ -88,7 +88,7 @@ If you need this functionality, you could specify the cluster as follows:
<dependency>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<version>
0.
9.1
</version>
<version>
0.
10.2
</version>
</dependency>
## III. Client Usage
...
...
apollo-client/pom.xml
浏览文件 @
49b27bd0
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/build/ApolloInjector.java
浏览文件 @
49b27bd0
...
...
@@ -10,7 +10,7 @@ import com.ctrip.framework.foundation.internals.ServiceBootstrap;
*/
public
class
ApolloInjector
{
private
static
volatile
Injector
s_injector
;
private
static
Object
lock
=
new
Object
();
private
static
final
Object
lock
=
new
Object
();
private
static
Injector
getInjector
()
{
if
(
s_injector
==
null
)
{
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultInjector.java
浏览文件 @
49b27bd0
...
...
@@ -7,9 +7,6 @@ import com.ctrip.framework.apollo.spi.ConfigRegistry;
import
com.ctrip.framework.apollo.spi.DefaultConfigFactory
;
import
com.ctrip.framework.apollo.spi.DefaultConfigFactoryManager
;
import
com.ctrip.framework.apollo.spi.DefaultConfigRegistry
;
import
com.ctrip.framework.apollo.spring.config.ConfigPropertySourceFactory
;
import
com.ctrip.framework.apollo.spring.property.PlaceholderHelper
;
import
com.ctrip.framework.apollo.spring.property.SpringValueRegistry
;
import
com.ctrip.framework.apollo.tracer.Tracer
;
import
com.ctrip.framework.apollo.util.ConfigUtil
;
import
com.ctrip.framework.apollo.util.http.HttpUtil
;
...
...
@@ -63,9 +60,6 @@ public class DefaultInjector implements Injector {
bind
(
HttpUtil
.
class
).
in
(
Singleton
.
class
);
bind
(
ConfigServiceLocator
.
class
).
in
(
Singleton
.
class
);
bind
(
RemoteConfigLongPollService
.
class
).
in
(
Singleton
.
class
);
bind
(
PlaceholderHelper
.
class
).
in
(
Singleton
.
class
);
bind
(
ConfigPropertySourceFactory
.
class
).
in
(
Singleton
.
class
);
bind
(
SpringValueRegistry
.
class
).
in
(
Singleton
.
class
);
}
}
}
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/annotation/ApolloJsonValueProcessor.java
浏览文件 @
49b27bd0
...
...
@@ -5,6 +5,7 @@ import com.ctrip.framework.apollo.spring.property.AutoUpdateConfigChangeListener
import
com.ctrip.framework.apollo.spring.property.PlaceholderHelper
;
import
com.ctrip.framework.apollo.spring.property.SpringValue
;
import
com.ctrip.framework.apollo.spring.property.SpringValueRegistry
;
import
com.ctrip.framework.apollo.spring.util.SpringInjector
;
import
com.ctrip.framework.apollo.util.ConfigUtil
;
import
com.google.common.base.Preconditions
;
import
com.google.gson.Gson
;
...
...
@@ -37,8 +38,8 @@ public class ApolloJsonValueProcessor extends ApolloProcessor implements BeanFac
public
ApolloJsonValueProcessor
()
{
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
placeholderHelper
=
Apollo
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
springValueRegistry
=
Apollo
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
placeholderHelper
=
Spring
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
springValueRegistry
=
Spring
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
}
@Override
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/annotation/SpringValueProcessor.java
浏览文件 @
49b27bd0
...
...
@@ -7,6 +7,7 @@ import com.ctrip.framework.apollo.spring.property.SpringValue;
import
com.ctrip.framework.apollo.spring.property.SpringValueDefinition
;
import
com.ctrip.framework.apollo.spring.property.SpringValueDefinitionProcessor
;
import
com.ctrip.framework.apollo.spring.property.SpringValueRegistry
;
import
com.ctrip.framework.apollo.spring.util.SpringInjector
;
import
com.ctrip.framework.apollo.util.ConfigUtil
;
import
com.google.common.collect.LinkedListMultimap
;
import
com.google.common.collect.Multimap
;
...
...
@@ -43,8 +44,8 @@ public class SpringValueProcessor extends ApolloProcessor implements BeanFactory
public
SpringValueProcessor
()
{
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
placeholderHelper
=
Apollo
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
springValueRegistry
=
Apollo
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
placeholderHelper
=
Spring
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
springValueRegistry
=
Spring
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
}
@Override
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/boot/ApolloApplicationContextInitializer.java
浏览文件 @
49b27bd0
...
...
@@ -6,6 +6,7 @@ import com.ctrip.framework.apollo.build.ApolloInjector;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.spring.config.ConfigPropertySourceFactory
;
import
com.ctrip.framework.apollo.spring.config.PropertySourcesConstants
;
import
com.ctrip.framework.apollo.spring.util.SpringInjector
;
import
com.google.common.base.Splitter
;
import
java.util.List
;
import
org.slf4j.Logger
;
...
...
@@ -37,7 +38,7 @@ public class ApolloApplicationContextInitializer implements
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApolloApplicationContextInitializer
.
class
);
private
static
final
Splitter
NAMESPACE_SPLITTER
=
Splitter
.
on
(
","
).
omitEmptyStrings
().
trimResults
();
private
final
ConfigPropertySourceFactory
configPropertySourceFactory
=
Apollo
Injector
private
final
ConfigPropertySourceFactory
configPropertySourceFactory
=
Spring
Injector
.
getInstance
(
ConfigPropertySourceFactory
.
class
);
@Override
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/config/PropertySourcesProcessor.java
浏览文件 @
49b27bd0
...
...
@@ -2,6 +2,7 @@ package com.ctrip.framework.apollo.spring.config;
import
com.ctrip.framework.apollo.build.ApolloInjector
;
import
com.ctrip.framework.apollo.spring.property.AutoUpdateConfigChangeListener
;
import
com.ctrip.framework.apollo.spring.util.SpringInjector
;
import
com.ctrip.framework.apollo.util.ConfigUtil
;
import
com.google.common.collect.ImmutableSortedSet
;
import
com.google.common.collect.LinkedHashMultimap
;
...
...
@@ -39,7 +40,7 @@ public class PropertySourcesProcessor implements BeanFactoryPostProcessor, Envir
private
static
final
Multimap
<
Integer
,
String
>
NAMESPACE_NAMES
=
LinkedHashMultimap
.
create
();
private
static
final
AtomicBoolean
INITIALIZED
=
new
AtomicBoolean
(
false
);
private
final
ConfigPropertySourceFactory
configPropertySourceFactory
=
Apollo
Injector
private
final
ConfigPropertySourceFactory
configPropertySourceFactory
=
Spring
Injector
.
getInstance
(
ConfigPropertySourceFactory
.
class
);
private
final
ConfigUtil
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
private
ConfigurableEnvironment
environment
;
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/AutoUpdateConfigChangeListener.java
浏览文件 @
49b27bd0
...
...
@@ -2,9 +2,11 @@ package com.ctrip.framework.apollo.spring.property;
import
com.ctrip.framework.apollo.ConfigChangeListener
;
import
com.ctrip.framework.apollo.build.ApolloInjector
;
import
com.ctrip.framework.apollo.enums.PropertyChangeType
;
import
com.ctrip.framework.apollo.model.ConfigChange
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.spring.annotation.SpringValueProcessor
;
import
com.ctrip.framework.apollo.spring.util.SpringInjector
;
import
com.google.gson.Gson
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Type
;
...
...
@@ -38,8 +40,8 @@ public class AutoUpdateConfigChangeListener implements ConfigChangeListener{
this
.
beanFactory
=
beanFactory
;
this
.
typeConverter
=
this
.
beanFactory
.
getTypeConverter
();
this
.
environment
=
environment
;
this
.
placeholderHelper
=
Apollo
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
this
.
springValueRegistry
=
Apollo
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
this
.
placeholderHelper
=
Spring
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
this
.
springValueRegistry
=
Spring
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
this
.
gson
=
new
Gson
();
}
...
...
@@ -57,8 +59,7 @@ public class AutoUpdateConfigChangeListener implements ConfigChangeListener{
}
// 2. check whether the value is really changed or not (since spring property sources have hierarchies)
ConfigChange
configChange
=
changeEvent
.
getChange
(
key
);
if
(!
Objects
.
equals
(
environment
.
getProperty
(
key
),
configChange
.
getNewValue
()))
{
if
(!
shouldTriggerAutoUpdate
(
changeEvent
,
key
))
{
continue
;
}
...
...
@@ -69,13 +70,30 @@ public class AutoUpdateConfigChangeListener implements ConfigChangeListener{
}
}
/**
* Check whether we should trigger the auto update or not.
* <br />
* For added or modified keys, we should trigger auto update if the current value in Spring equals to the new value.
* <br />
* For deleted keys, we will trigger auto update anyway.
*/
private
boolean
shouldTriggerAutoUpdate
(
ConfigChangeEvent
changeEvent
,
String
changedKey
)
{
ConfigChange
configChange
=
changeEvent
.
getChange
(
changedKey
);
if
(
configChange
.
getChangeType
()
==
PropertyChangeType
.
DELETED
)
{
return
true
;
}
return
Objects
.
equals
(
environment
.
getProperty
(
changedKey
),
configChange
.
getNewValue
());
}
private
void
updateSpringValue
(
SpringValue
springValue
)
{
try
{
Object
value
=
resolvePropertyValue
(
springValue
);
springValue
.
update
(
value
);
logger
.
debug
(
"Auto update apollo changed value successfully, new value: {}, {}"
,
value
,
springValue
.
toString
()
);
springValue
);
}
catch
(
Throwable
ex
)
{
logger
.
error
(
"Auto update apollo changed value failed, {}"
,
springValue
.
toString
(),
ex
);
}
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/SpringValueDefinitionProcessor.java
浏览文件 @
49b27bd0
package
com.ctrip.framework.apollo.spring.property
;
import
com.ctrip.framework.apollo.spring.util.SpringInjector
;
import
java.util.List
;
import
java.util.Set
;
...
...
@@ -38,7 +39,7 @@ public class SpringValueDefinitionProcessor implements BeanDefinitionRegistryPos
public
SpringValueDefinitionProcessor
()
{
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
placeholderHelper
=
Apollo
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
placeholderHelper
=
Spring
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
}
@Override
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/util/SpringInjector.java
0 → 100644
浏览文件 @
49b27bd0
package
com.ctrip.framework.apollo.spring.util
;
import
com.ctrip.framework.apollo.exceptions.ApolloConfigException
;
import
com.ctrip.framework.apollo.spring.config.ConfigPropertySourceFactory
;
import
com.ctrip.framework.apollo.spring.property.PlaceholderHelper
;
import
com.ctrip.framework.apollo.spring.property.SpringValueRegistry
;
import
com.ctrip.framework.apollo.tracer.Tracer
;
import
com.google.inject.AbstractModule
;
import
com.google.inject.Guice
;
import
com.google.inject.Injector
;
import
com.google.inject.Singleton
;
public
class
SpringInjector
{
private
static
volatile
Injector
s_injector
;
private
static
final
Object
lock
=
new
Object
();
private
static
Injector
getInjector
()
{
if
(
s_injector
==
null
)
{
synchronized
(
lock
)
{
if
(
s_injector
==
null
)
{
try
{
s_injector
=
Guice
.
createInjector
(
new
SpringModule
());
}
catch
(
Throwable
ex
)
{
ApolloConfigException
exception
=
new
ApolloConfigException
(
"Unable to initialize Apollo Spring Injector!"
,
ex
);
Tracer
.
logError
(
exception
);
throw
exception
;
}
}
}
}
return
s_injector
;
}
public
static
<
T
>
T
getInstance
(
Class
<
T
>
clazz
)
{
try
{
return
getInjector
().
getInstance
(
clazz
);
}
catch
(
Throwable
ex
)
{
Tracer
.
logError
(
ex
);
throw
new
ApolloConfigException
(
String
.
format
(
"Unable to load instance for %s!"
,
clazz
.
getName
()),
ex
);
}
}
private
static
class
SpringModule
extends
AbstractModule
{
@Override
protected
void
configure
()
{
bind
(
PlaceholderHelper
.
class
).
in
(
Singleton
.
class
);
bind
(
ConfigPropertySourceFactory
.
class
).
in
(
Singleton
.
class
);
bind
(
SpringValueRegistry
.
class
).
in
(
Singleton
.
class
);
}
}
}
apollo-client/src/test/java/com/ctrip/framework/apollo/spring/JavaConfigPlaceholderAutoUpdateTest.java
浏览文件 @
49b27bd0
...
...
@@ -65,7 +65,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
...
@@ -98,7 +98,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
javaConfigBean
.
getTimeout
());
assertEquals
(
newBatch
,
javaConfigBean
.
getBatch
());
...
...
@@ -135,7 +135,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
...
@@ -165,7 +165,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
...
@@ -174,7 +174,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
...
@@ -192,7 +192,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
Properties
fxApolloProperties
=
assembleProperties
(
TIMEOUT_PROPERTY
,
String
.
valueOf
(
someTimeout
),
BATCH_PROPERTY
,
String
.
valueOf
(
anotherBatch
));
SimpleConfig
applicationConfig
=
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
applicationProperties
);
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
applicationProperties
);
SimpleConfig
fxApolloConfig
=
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
AppConfig2
.
class
);
...
...
@@ -207,7 +207,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewTimeout
,
bean
.
getTimeout
());
assertEquals
(
someBatch
,
bean
.
getBatch
());
...
...
@@ -235,7 +235,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
...
@@ -268,7 +268,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
...
...
@@ -295,12 +295,42 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
DEFAULT_TIMEOUT
,
bean
.
getTimeout
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
}
@Test
public
void
testAutoUpdateWithMultipleNamespacesWithSamePropertiesDeleted
()
throws
Exception
{
int
someTimeout
=
1000
;
int
someBatch
=
2000
;
int
anotherBatch
=
3000
;
Properties
applicationProperties
=
assembleProperties
(
BATCH_PROPERTY
,
String
.
valueOf
(
someBatch
));
Properties
fxApolloProperties
=
assembleProperties
(
TIMEOUT_PROPERTY
,
String
.
valueOf
(
someTimeout
),
BATCH_PROPERTY
,
String
.
valueOf
(
anotherBatch
));
SimpleConfig
applicationConfig
=
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
applicationProperties
);
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
AppConfig2
.
class
);
TestJavaConfigBean
bean
=
context
.
getBean
(
TestJavaConfigBean
.
class
);
assertEquals
(
someTimeout
,
bean
.
getTimeout
());
assertEquals
(
someBatch
,
bean
.
getBatch
());
Properties
newProperties
=
new
Properties
();
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
100
);
assertEquals
(
someTimeout
,
bean
.
getTimeout
());
assertEquals
(
anotherBatch
,
bean
.
getBatch
());
}
@Test
public
void
testAutoUpdateWithDeletedPropertiesWithNoDefaultValue
()
throws
Exception
{
int
initialTimeout
=
1000
;
...
...
@@ -323,7 +353,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
...
@@ -353,7 +383,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
...
@@ -383,7 +413,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
...
...
@@ -414,7 +444,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
...
...
@@ -445,7 +475,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
...
...
@@ -476,7 +506,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
...
...
@@ -507,7 +537,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewValue
,
bean
.
getNestedProperty
());
}
...
...
@@ -535,7 +565,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
assertEquals
(
someValue
,
bean
.
getNestedProperty
());
...
...
@@ -564,7 +594,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewValue
,
bean
.
getNestedProperty
());
}
...
...
@@ -601,7 +631,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewValue
,
bean
.
getNestedProperty
());
}
...
...
@@ -683,7 +713,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewInt
,
bean
.
getIntProperty
());
assertArrayEquals
(
someNewIntArray
,
bean
.
getIntArrayProperty
());
...
...
@@ -721,7 +751,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// should not change anything
assertTrue
(
jsonBean
==
bean
.
getJsonBean
());
...
...
@@ -748,7 +778,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// should not change anything
assertTrue
(
jsonBean
==
bean
.
getJsonBean
());
...
...
@@ -775,7 +805,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
JsonBean
newJsonBean
=
bean
.
getJsonBean
();
...
...
apollo-client/src/test/java/com/ctrip/framework/apollo/spring/XmlConfigPlaceholderAutoUpdateTest.java
浏览文件 @
49b27bd0
...
...
@@ -49,7 +49,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
...
@@ -84,7 +84,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
...
@@ -119,7 +119,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
...
@@ -128,7 +128,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
...
@@ -147,8 +147,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
Properties
fxApolloProperties
=
assembleProperties
(
TIMEOUT_PROPERTY
,
String
.
valueOf
(
someTimeout
),
BATCH_PROPERTY
,
String
.
valueOf
(
anotherBatch
));
SimpleConfig
applicationConfig
=
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
applicationProperties
);
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
applicationProperties
);
SimpleConfig
fxApolloConfig
=
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
ClassPathXmlApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"spring/XmlConfigPlaceholderTest3.xml"
);
...
...
@@ -163,7 +162,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewTimeout
,
bean
.
getTimeout
());
assertEquals
(
someBatch
,
bean
.
getBatch
());
...
...
@@ -194,7 +193,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
...
@@ -229,7 +228,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
...
...
@@ -256,12 +255,44 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
DEFAULT_TIMEOUT
,
bean
.
getTimeout
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
}
@Test
public
void
testAutoUpdateWithMultipleNamespacesWithSamePropertiesDeleted
()
throws
Exception
{
int
someTimeout
=
1000
;
int
someBatch
=
2000
;
int
anotherBatch
=
3000
;
Properties
applicationProperties
=
assembleProperties
(
BATCH_PROPERTY
,
String
.
valueOf
(
someBatch
));
Properties
fxApolloProperties
=
assembleProperties
(
TIMEOUT_PROPERTY
,
String
.
valueOf
(
someTimeout
),
BATCH_PROPERTY
,
String
.
valueOf
(
anotherBatch
));
SimpleConfig
applicationConfig
=
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
applicationProperties
);
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
ClassPathXmlApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"spring/XmlConfigPlaceholderTest3.xml"
);
TestXmlBean
bean
=
context
.
getBean
(
TestXmlBean
.
class
);
assertEquals
(
someTimeout
,
bean
.
getTimeout
());
assertEquals
(
someBatch
,
bean
.
getBatch
());
Properties
newProperties
=
new
Properties
();
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
100
);
assertEquals
(
someTimeout
,
bean
.
getTimeout
());
assertEquals
(
anotherBatch
,
bean
.
getBatch
());
}
@Test
public
void
testAutoUpdateWithDeletedPropertiesWithNoDefaultValue
()
throws
Exception
{
int
initialTimeout
=
1000
;
...
...
@@ -284,7 +315,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
...
@@ -314,7 +345,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
...
@@ -344,7 +375,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
...
...
@@ -375,7 +406,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
...
@@ -451,7 +482,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewInt
,
bean
.
getIntProperty
());
assertArrayEquals
(
someNewIntArray
,
bean
.
getIntArrayProperty
());
...
...
apollo-common/pom.xml
浏览文件 @
49b27bd0
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-configservice/pom.xml
浏览文件 @
49b27bd0
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-configservice/src/main/docker/Dockerfile
浏览文件 @
49b27bd0
...
...
@@ -7,7 +7,7 @@
FROM
openjdk:8-jre-alpine
MAINTAINER
ameizi <sxyx2008@163.com>
ENV
VERSION 0.10.
0-SNAPSHOT
ENV
VERSION 0.10.
2
RUN
echo
"http://mirrors.aliyun.com/alpine/v3.6/main"
>
/etc/apk/repositories
\
&&
echo
"http://mirrors.aliyun.com/alpine/v3.6/community"
>>
/etc/apk/repositories
\
...
...
apollo-core/pom.xml
浏览文件 @
49b27bd0
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-demo/pom.xml
浏览文件 @
49b27bd0
...
...
@@ -4,7 +4,7 @@
<parent>
<artifactId>
apollo
</artifactId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-demo
</artifactId>
...
...
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/springBootDemo/config/SampleRedisConfig.java
浏览文件 @
49b27bd0
...
...
@@ -27,9 +27,7 @@ import javax.annotation.PostConstruct;
* </pre>
*
* To make <code>@ConditionalOnProperty</code> work properly, <code>apollo.bootstrap.enabled</code> should be set to true
* and <code>redis.cache.enabled</code> should also be set to true.
*
* @see resources/bootstrap.yml
* and <code>redis.cache.enabled</code> should also be set to true. Check 'src/main/resources/application.yml' for more information.
*
* @author Jason Song(song_s@ctrip.com)
*/
...
...
apollo-portal/pom.xml
浏览文件 @
49b27bd0
...
...
@@ -4,7 +4,7 @@
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-portal/src/main/docker/Dockerfile
浏览文件 @
49b27bd0
...
...
@@ -9,7 +9,7 @@
FROM
openjdk:8-jre-alpine
MAINTAINER
ameizi <sxyx2008@163.com>
ENV
VERSION 0.10.
0-SNAPSHOT
ENV
VERSION 0.10.
2
RUN
echo
"http://mirrors.aliyun.com/alpine/v3.6/main"
>
/etc/apk/repositories
\
&&
echo
"http://mirrors.aliyun.com/alpine/v3.6/community"
>>
/etc/apk/repositories
\
...
...
doc/images/known-users/enmonster.png
0 → 100644
浏览文件 @
49b27bd0
9.7 KB
pom.xml
浏览文件 @
49b27bd0
...
...
@@ -5,7 +5,7 @@
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0-SNAPSHOT
</version>
<version>
0.10.
2
</version>
<name>
Apollo
</name>
<packaging>
pom
</packaging>
<description>
Ctrip Configuration Center
</description>
...
...
scripts/sql/apolloconfigdb.sql
浏览文件 @
49b27bd0
...
...
@@ -366,9 +366,9 @@ INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`)
VALUES
(
'eureka.service.url'
,
'default'
,
'http://localhost:8080/eureka/'
,
'Eureka服务Url,多个service以英文逗号分隔'
),
(
'namespace.lock.switch'
,
'default'
,
'false'
,
'一次发布只能有一个人修改开关'
),
(
'item.key.length.limit'
,
'default'
,
'128'
,
'item key 最大长度限制'
),
(
'item.value.length.limit'
,
'default'
,
'20000'
,
'item value最大长度限制'
),
(
'config-service.cache.enabled'
,
'default'
,
'false'
,
'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'
),
(
'item.key.length.limit'
,
'default'
,
'128'
,
'item key 最大长度限制'
);
(
'config-service.cache.enabled'
,
'default'
,
'false'
,
'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'
);
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */
;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录