Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
6b2467df
Unverified
Commit
6b2467df
authored
Mar 27, 2018
by
Jason Song
Committed by
GitHub
Mar 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1019 from nobodyiam/0.10.1
fix the issue brought by 0.10.0 that Spring related classes are mistakenly loaded via DefaultInjector
parents
37b6485c
3990dc3c
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
126 additions
and
74 deletions
+126
-74
pom.xml
apollo-adminservice/pom.xml
+1
-1
Dockerfile
apollo-adminservice/src/main/docker/Dockerfile
+1
-1
pom.xml
apollo-assembly/pom.xml
+1
-1
pom.xml
apollo-biz/pom.xml
+1
-1
pom.xml
apollo-buildtools/pom.xml
+1
-1
README.md
apollo-client/README.md
+1
-1
pom.xml
apollo-client/pom.xml
+1
-1
ApolloInjector.java
...java/com/ctrip/framework/apollo/build/ApolloInjector.java
+1
-1
DefaultInjector.java
...com/ctrip/framework/apollo/internals/DefaultInjector.java
+0
-6
ApolloJsonValueProcessor.java
...rk/apollo/spring/annotation/ApolloJsonValueProcessor.java
+3
-2
SpringValueProcessor.java
...mework/apollo/spring/annotation/SpringValueProcessor.java
+3
-2
ApolloApplicationContextInitializer.java
...ollo/spring/boot/ApolloApplicationContextInitializer.java
+2
-1
PropertySourcesProcessor.java
...mework/apollo/spring/config/PropertySourcesProcessor.java
+2
-1
AutoUpdateConfigChangeListener.java
...pollo/spring/property/AutoUpdateConfigChangeListener.java
+3
-2
SpringValueDefinitionProcessor.java
...pollo/spring/property/SpringValueDefinitionProcessor.java
+2
-1
SpringInjector.java
...om/ctrip/framework/apollo/spring/util/SpringInjector.java
+53
-0
JavaConfigPlaceholderAutoUpdateTest.java
...rk/apollo/spring/JavaConfigPlaceholderAutoUpdateTest.java
+26
-26
XmlConfigPlaceholderAutoUpdateTest.java
...ork/apollo/spring/XmlConfigPlaceholderAutoUpdateTest.java
+16
-17
pom.xml
apollo-common/pom.xml
+1
-1
pom.xml
apollo-configservice/pom.xml
+1
-1
Dockerfile
apollo-configservice/src/main/docker/Dockerfile
+1
-1
pom.xml
apollo-core/pom.xml
+1
-1
pom.xml
apollo-demo/pom.xml
+1
-1
pom.xml
apollo-portal/pom.xml
+1
-1
Dockerfile
apollo-portal/src/main/docker/Dockerfile
+1
-1
pom.xml
pom.xml
+1
-1
No files found.
apollo-adminservice/pom.xml
View file @
6b2467df
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<parent>
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
<relativePath>
../pom.xml
</relativePath>
<relativePath>
../pom.xml
</relativePath>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-adminservice/src/main/docker/Dockerfile
View file @
6b2467df
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
FROM
openjdk:8-jre-alpine
FROM
openjdk:8-jre-alpine
MAINTAINER
ameizi <sxyx2008@163.com>
MAINTAINER
ameizi <sxyx2008@163.com>
ENV
VERSION 0.10.
0
ENV
VERSION 0.10.
1
RUN
echo
"http://mirrors.aliyun.com/alpine/v3.6/main"
>
/etc/apk/repositories
\
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
\
&&
echo
"http://mirrors.aliyun.com/alpine/v3.6/community"
>>
/etc/apk/repositories
\
...
...
apollo-assembly/pom.xml
View file @
6b2467df
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<parent>
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
<relativePath>
../pom.xml
</relativePath>
<relativePath>
../pom.xml
</relativePath>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-biz/pom.xml
View file @
6b2467df
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<parent>
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-biz
</artifactId>
<artifactId>
apollo-biz
</artifactId>
...
...
apollo-buildtools/pom.xml
View file @
6b2467df
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<parent>
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
<relativePath>
../pom.xml
</relativePath>
<relativePath>
../pom.xml
</relativePath>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-client/README.md
View file @
6b2467df
...
@@ -88,7 +88,7 @@ If you need this functionality, you could specify the cluster as follows:
...
@@ -88,7 +88,7 @@ If you need this functionality, you could specify the cluster as follows:
<dependency>
<dependency>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo-client
</artifactId>
<artifactId>
apollo-client
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
</dependency>
</dependency>
## III. Client Usage
## III. Client Usage
...
...
apollo-client/pom.xml
View file @
6b2467df
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<parent>
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
<relativePath>
../pom.xml
</relativePath>
<relativePath>
../pom.xml
</relativePath>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/build/ApolloInjector.java
View file @
6b2467df
...
@@ -10,7 +10,7 @@ import com.ctrip.framework.foundation.internals.ServiceBootstrap;
...
@@ -10,7 +10,7 @@ import com.ctrip.framework.foundation.internals.ServiceBootstrap;
*/
*/
public
class
ApolloInjector
{
public
class
ApolloInjector
{
private
static
volatile
Injector
s_injector
;
private
static
volatile
Injector
s_injector
;
private
static
Object
lock
=
new
Object
();
private
static
final
Object
lock
=
new
Object
();
private
static
Injector
getInjector
()
{
private
static
Injector
getInjector
()
{
if
(
s_injector
==
null
)
{
if
(
s_injector
==
null
)
{
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultInjector.java
View file @
6b2467df
...
@@ -7,9 +7,6 @@ import com.ctrip.framework.apollo.spi.ConfigRegistry;
...
@@ -7,9 +7,6 @@ import com.ctrip.framework.apollo.spi.ConfigRegistry;
import
com.ctrip.framework.apollo.spi.DefaultConfigFactory
;
import
com.ctrip.framework.apollo.spi.DefaultConfigFactory
;
import
com.ctrip.framework.apollo.spi.DefaultConfigFactoryManager
;
import
com.ctrip.framework.apollo.spi.DefaultConfigFactoryManager
;
import
com.ctrip.framework.apollo.spi.DefaultConfigRegistry
;
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.tracer.Tracer
;
import
com.ctrip.framework.apollo.util.ConfigUtil
;
import
com.ctrip.framework.apollo.util.ConfigUtil
;
import
com.ctrip.framework.apollo.util.http.HttpUtil
;
import
com.ctrip.framework.apollo.util.http.HttpUtil
;
...
@@ -63,9 +60,6 @@ public class DefaultInjector implements Injector {
...
@@ -63,9 +60,6 @@ public class DefaultInjector implements Injector {
bind
(
HttpUtil
.
class
).
in
(
Singleton
.
class
);
bind
(
HttpUtil
.
class
).
in
(
Singleton
.
class
);
bind
(
ConfigServiceLocator
.
class
).
in
(
Singleton
.
class
);
bind
(
ConfigServiceLocator
.
class
).
in
(
Singleton
.
class
);
bind
(
RemoteConfigLongPollService
.
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
View file @
6b2467df
...
@@ -5,6 +5,7 @@ import com.ctrip.framework.apollo.spring.property.AutoUpdateConfigChangeListener
...
@@ -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.PlaceholderHelper
;
import
com.ctrip.framework.apollo.spring.property.SpringValue
;
import
com.ctrip.framework.apollo.spring.property.SpringValue
;
import
com.ctrip.framework.apollo.spring.property.SpringValueRegistry
;
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.ctrip.framework.apollo.util.ConfigUtil
;
import
com.google.common.base.Preconditions
;
import
com.google.common.base.Preconditions
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
...
@@ -37,8 +38,8 @@ public class ApolloJsonValueProcessor extends ApolloProcessor implements BeanFac
...
@@ -37,8 +38,8 @@ public class ApolloJsonValueProcessor extends ApolloProcessor implements BeanFac
public
ApolloJsonValueProcessor
()
{
public
ApolloJsonValueProcessor
()
{
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
placeholderHelper
=
Apollo
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
placeholderHelper
=
Spring
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
springValueRegistry
=
Apollo
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
springValueRegistry
=
Spring
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
}
}
@Override
@Override
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/annotation/SpringValueProcessor.java
View file @
6b2467df
...
@@ -7,6 +7,7 @@ import com.ctrip.framework.apollo.spring.property.SpringValue;
...
@@ -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.SpringValueDefinition
;
import
com.ctrip.framework.apollo.spring.property.SpringValueDefinitionProcessor
;
import
com.ctrip.framework.apollo.spring.property.SpringValueDefinitionProcessor
;
import
com.ctrip.framework.apollo.spring.property.SpringValueRegistry
;
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.ctrip.framework.apollo.util.ConfigUtil
;
import
com.google.common.collect.LinkedListMultimap
;
import
com.google.common.collect.LinkedListMultimap
;
import
com.google.common.collect.Multimap
;
import
com.google.common.collect.Multimap
;
...
@@ -43,8 +44,8 @@ public class SpringValueProcessor extends ApolloProcessor implements BeanFactory
...
@@ -43,8 +44,8 @@ public class SpringValueProcessor extends ApolloProcessor implements BeanFactory
public
SpringValueProcessor
()
{
public
SpringValueProcessor
()
{
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
placeholderHelper
=
Apollo
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
placeholderHelper
=
Spring
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
springValueRegistry
=
Apollo
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
springValueRegistry
=
Spring
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
}
}
@Override
@Override
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/boot/ApolloApplicationContextInitializer.java
View file @
6b2467df
...
@@ -6,6 +6,7 @@ import com.ctrip.framework.apollo.build.ApolloInjector;
...
@@ -6,6 +6,7 @@ import com.ctrip.framework.apollo.build.ApolloInjector;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.core.ConfigConsts
;
import
com.ctrip.framework.apollo.spring.config.ConfigPropertySourceFactory
;
import
com.ctrip.framework.apollo.spring.config.ConfigPropertySourceFactory
;
import
com.ctrip.framework.apollo.spring.config.PropertySourcesConstants
;
import
com.ctrip.framework.apollo.spring.config.PropertySourcesConstants
;
import
com.ctrip.framework.apollo.spring.util.SpringInjector
;
import
com.google.common.base.Splitter
;
import
com.google.common.base.Splitter
;
import
java.util.List
;
import
java.util.List
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -37,7 +38,7 @@ public class ApolloApplicationContextInitializer implements
...
@@ -37,7 +38,7 @@ public class ApolloApplicationContextInitializer implements
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApolloApplicationContextInitializer
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApolloApplicationContextInitializer
.
class
);
private
static
final
Splitter
NAMESPACE_SPLITTER
=
Splitter
.
on
(
","
).
omitEmptyStrings
().
trimResults
();
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
);
.
getInstance
(
ConfigPropertySourceFactory
.
class
);
@Override
@Override
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/config/PropertySourcesProcessor.java
View file @
6b2467df
...
@@ -2,6 +2,7 @@ package com.ctrip.framework.apollo.spring.config;
...
@@ -2,6 +2,7 @@ package com.ctrip.framework.apollo.spring.config;
import
com.ctrip.framework.apollo.build.ApolloInjector
;
import
com.ctrip.framework.apollo.build.ApolloInjector
;
import
com.ctrip.framework.apollo.spring.property.AutoUpdateConfigChangeListener
;
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.ctrip.framework.apollo.util.ConfigUtil
;
import
com.google.common.collect.ImmutableSortedSet
;
import
com.google.common.collect.ImmutableSortedSet
;
import
com.google.common.collect.LinkedHashMultimap
;
import
com.google.common.collect.LinkedHashMultimap
;
...
@@ -39,7 +40,7 @@ public class PropertySourcesProcessor implements BeanFactoryPostProcessor, Envir
...
@@ -39,7 +40,7 @@ public class PropertySourcesProcessor implements BeanFactoryPostProcessor, Envir
private
static
final
Multimap
<
Integer
,
String
>
NAMESPACE_NAMES
=
LinkedHashMultimap
.
create
();
private
static
final
Multimap
<
Integer
,
String
>
NAMESPACE_NAMES
=
LinkedHashMultimap
.
create
();
private
static
final
AtomicBoolean
INITIALIZED
=
new
AtomicBoolean
(
false
);
private
static
final
AtomicBoolean
INITIALIZED
=
new
AtomicBoolean
(
false
);
private
final
ConfigPropertySourceFactory
configPropertySourceFactory
=
Apollo
Injector
private
final
ConfigPropertySourceFactory
configPropertySourceFactory
=
Spring
Injector
.
getInstance
(
ConfigPropertySourceFactory
.
class
);
.
getInstance
(
ConfigPropertySourceFactory
.
class
);
private
final
ConfigUtil
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
private
final
ConfigUtil
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
private
ConfigurableEnvironment
environment
;
private
ConfigurableEnvironment
environment
;
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/AutoUpdateConfigChangeListener.java
View file @
6b2467df
...
@@ -6,6 +6,7 @@ import com.ctrip.framework.apollo.enums.PropertyChangeType;
...
@@ -6,6 +6,7 @@ import com.ctrip.framework.apollo.enums.PropertyChangeType;
import
com.ctrip.framework.apollo.model.ConfigChange
;
import
com.ctrip.framework.apollo.model.ConfigChange
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.spring.annotation.SpringValueProcessor
;
import
com.ctrip.framework.apollo.spring.annotation.SpringValueProcessor
;
import
com.ctrip.framework.apollo.spring.util.SpringInjector
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Type
;
import
java.lang.reflect.Type
;
...
@@ -39,8 +40,8 @@ public class AutoUpdateConfigChangeListener implements ConfigChangeListener{
...
@@ -39,8 +40,8 @@ public class AutoUpdateConfigChangeListener implements ConfigChangeListener{
this
.
beanFactory
=
beanFactory
;
this
.
beanFactory
=
beanFactory
;
this
.
typeConverter
=
this
.
beanFactory
.
getTypeConverter
();
this
.
typeConverter
=
this
.
beanFactory
.
getTypeConverter
();
this
.
environment
=
environment
;
this
.
environment
=
environment
;
this
.
placeholderHelper
=
Apollo
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
this
.
placeholderHelper
=
Spring
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
this
.
springValueRegistry
=
Apollo
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
this
.
springValueRegistry
=
Spring
Injector
.
getInstance
(
SpringValueRegistry
.
class
);
this
.
gson
=
new
Gson
();
this
.
gson
=
new
Gson
();
}
}
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/SpringValueDefinitionProcessor.java
View file @
6b2467df
package
com
.
ctrip
.
framework
.
apollo
.
spring
.
property
;
package
com
.
ctrip
.
framework
.
apollo
.
spring
.
property
;
import
com.ctrip.framework.apollo.spring.util.SpringInjector
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
...
@@ -38,7 +39,7 @@ public class SpringValueDefinitionProcessor implements BeanDefinitionRegistryPos
...
@@ -38,7 +39,7 @@ public class SpringValueDefinitionProcessor implements BeanDefinitionRegistryPos
public
SpringValueDefinitionProcessor
()
{
public
SpringValueDefinitionProcessor
()
{
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
configUtil
=
ApolloInjector
.
getInstance
(
ConfigUtil
.
class
);
placeholderHelper
=
Apollo
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
placeholderHelper
=
Spring
Injector
.
getInstance
(
PlaceholderHelper
.
class
);
}
}
@Override
@Override
...
...
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/util/SpringInjector.java
0 → 100644
View file @
6b2467df
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
View file @
6b2467df
...
@@ -65,7 +65,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -65,7 +65,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
@@ -98,7 +98,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -98,7 +98,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
javaConfigBean
.
getTimeout
());
assertEquals
(
newTimeout
,
javaConfigBean
.
getTimeout
());
assertEquals
(
newBatch
,
javaConfigBean
.
getBatch
());
assertEquals
(
newBatch
,
javaConfigBean
.
getBatch
());
...
@@ -135,7 +135,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -135,7 +135,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
@@ -165,7 +165,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -165,7 +165,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
@@ -174,7 +174,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -174,7 +174,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
@@ -192,7 +192,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -192,7 +192,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
Properties
fxApolloProperties
=
Properties
fxApolloProperties
=
assembleProperties
(
TIMEOUT_PROPERTY
,
String
.
valueOf
(
someTimeout
),
BATCH_PROPERTY
,
String
.
valueOf
(
anotherBatch
));
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
);
SimpleConfig
fxApolloConfig
=
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
AppConfig2
.
class
);
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
AppConfig2
.
class
);
...
@@ -207,7 +207,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -207,7 +207,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewTimeout
,
bean
.
getTimeout
());
assertEquals
(
someNewTimeout
,
bean
.
getTimeout
());
assertEquals
(
someBatch
,
bean
.
getBatch
());
assertEquals
(
someBatch
,
bean
.
getBatch
());
...
@@ -235,7 +235,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -235,7 +235,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
@@ -268,7 +268,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -268,7 +268,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
...
@@ -295,7 +295,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -295,7 +295,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
DEFAULT_TIMEOUT
,
bean
.
getTimeout
());
assertEquals
(
DEFAULT_TIMEOUT
,
bean
.
getTimeout
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
...
@@ -312,7 +312,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -312,7 +312,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
assembleProperties
(
TIMEOUT_PROPERTY
,
String
.
valueOf
(
someTimeout
),
BATCH_PROPERTY
,
String
.
valueOf
(
anotherBatch
));
assembleProperties
(
TIMEOUT_PROPERTY
,
String
.
valueOf
(
someTimeout
),
BATCH_PROPERTY
,
String
.
valueOf
(
anotherBatch
));
SimpleConfig
applicationConfig
=
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
applicationProperties
);
SimpleConfig
applicationConfig
=
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
applicationProperties
);
SimpleConfig
fxApolloConfig
=
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
AppConfig2
.
class
);
AnnotationConfigApplicationContext
context
=
new
AnnotationConfigApplicationContext
(
AppConfig2
.
class
);
...
@@ -325,7 +325,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -325,7 +325,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someTimeout
,
bean
.
getTimeout
());
assertEquals
(
someTimeout
,
bean
.
getTimeout
());
assertEquals
(
anotherBatch
,
bean
.
getBatch
());
assertEquals
(
anotherBatch
,
bean
.
getBatch
());
...
@@ -353,7 +353,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -353,7 +353,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
@@ -383,7 +383,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -383,7 +383,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
@@ -413,7 +413,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -413,7 +413,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
// Does not support this scenario
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
...
@@ -444,7 +444,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -444,7 +444,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
// Does not support this scenario
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
...
@@ -475,7 +475,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -475,7 +475,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
// Does not support this scenario
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
...
@@ -506,7 +506,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -506,7 +506,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
// Does not support this scenario
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
...
@@ -537,7 +537,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -537,7 +537,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewValue
,
bean
.
getNestedProperty
());
assertEquals
(
someNewValue
,
bean
.
getNestedProperty
());
}
}
...
@@ -565,7 +565,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -565,7 +565,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
// Does not support this scenario
assertEquals
(
someValue
,
bean
.
getNestedProperty
());
assertEquals
(
someValue
,
bean
.
getNestedProperty
());
...
@@ -594,7 +594,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -594,7 +594,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewValue
,
bean
.
getNestedProperty
());
assertEquals
(
someNewValue
,
bean
.
getNestedProperty
());
}
}
...
@@ -631,7 +631,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -631,7 +631,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewValue
,
bean
.
getNestedProperty
());
assertEquals
(
someNewValue
,
bean
.
getNestedProperty
());
}
}
...
@@ -713,7 +713,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -713,7 +713,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewInt
,
bean
.
getIntProperty
());
assertEquals
(
someNewInt
,
bean
.
getIntProperty
());
assertArrayEquals
(
someNewIntArray
,
bean
.
getIntArrayProperty
());
assertArrayEquals
(
someNewIntArray
,
bean
.
getIntArrayProperty
());
...
@@ -751,7 +751,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -751,7 +751,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// should not change anything
// should not change anything
assertTrue
(
jsonBean
==
bean
.
getJsonBean
());
assertTrue
(
jsonBean
==
bean
.
getJsonBean
());
...
@@ -778,7 +778,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -778,7 +778,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// should not change anything
// should not change anything
assertTrue
(
jsonBean
==
bean
.
getJsonBean
());
assertTrue
(
jsonBean
==
bean
.
getJsonBean
());
...
@@ -805,7 +805,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
...
@@ -805,7 +805,7 @@ public class JavaConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegrati
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
JsonBean
newJsonBean
=
bean
.
getJsonBean
();
JsonBean
newJsonBean
=
bean
.
getJsonBean
();
...
...
apollo-client/src/test/java/com/ctrip/framework/apollo/spring/XmlConfigPlaceholderAutoUpdateTest.java
View file @
6b2467df
...
@@ -49,7 +49,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -49,7 +49,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
@@ -84,7 +84,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -84,7 +84,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
@@ -119,7 +119,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -119,7 +119,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
applicationConfig
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
@@ -128,7 +128,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -128,7 +128,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
@@ -147,8 +147,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -147,8 +147,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
Properties
fxApolloProperties
=
assembleProperties
(
TIMEOUT_PROPERTY
,
Properties
fxApolloProperties
=
assembleProperties
(
TIMEOUT_PROPERTY
,
String
.
valueOf
(
someTimeout
),
BATCH_PROPERTY
,
String
.
valueOf
(
anotherBatch
));
String
.
valueOf
(
someTimeout
),
BATCH_PROPERTY
,
String
.
valueOf
(
anotherBatch
));
SimpleConfig
applicationConfig
=
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
applicationProperties
);
applicationProperties
);
SimpleConfig
fxApolloConfig
=
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
SimpleConfig
fxApolloConfig
=
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
ClassPathXmlApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"spring/XmlConfigPlaceholderTest3.xml"
);
ClassPathXmlApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"spring/XmlConfigPlaceholderTest3.xml"
);
...
@@ -163,7 +162,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -163,7 +162,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
fxApolloConfig
.
onRepositoryChange
(
FX_APOLLO_NAMESPACE
,
newFxApolloProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewTimeout
,
bean
.
getTimeout
());
assertEquals
(
someNewTimeout
,
bean
.
getTimeout
());
assertEquals
(
someBatch
,
bean
.
getBatch
());
assertEquals
(
someBatch
,
bean
.
getBatch
());
...
@@ -194,7 +193,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -194,7 +193,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
applicationConfig
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
@@ -229,7 +228,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -229,7 +228,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
applicationConfig
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newApplicationProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
...
@@ -256,7 +255,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -256,7 +255,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
DEFAULT_TIMEOUT
,
bean
.
getTimeout
());
assertEquals
(
DEFAULT_TIMEOUT
,
bean
.
getTimeout
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
assertEquals
(
DEFAULT_BATCH
,
bean
.
getBatch
());
...
@@ -275,7 +274,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -275,7 +274,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
SimpleConfig
applicationConfig
=
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
SimpleConfig
applicationConfig
=
prepareConfig
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
applicationProperties
);
applicationProperties
);
SimpleConfig
fxApolloConfig
=
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
prepareConfig
(
FX_APOLLO_NAMESPACE
,
fxApolloProperties
);
ClassPathXmlApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"spring/XmlConfigPlaceholderTest3.xml"
);
ClassPathXmlApplicationContext
context
=
new
ClassPathXmlApplicationContext
(
"spring/XmlConfigPlaceholderTest3.xml"
);
...
@@ -288,7 +287,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -288,7 +287,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
applicationConfig
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someTimeout
,
bean
.
getTimeout
());
assertEquals
(
someTimeout
,
bean
.
getTimeout
());
assertEquals
(
anotherBatch
,
bean
.
getBatch
());
assertEquals
(
anotherBatch
,
bean
.
getBatch
());
...
@@ -316,7 +315,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -316,7 +315,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
@@ -346,7 +345,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -346,7 +345,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
assertEquals
(
initialBatch
,
bean
.
getBatch
());
...
@@ -376,7 +375,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -376,7 +375,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
// Does not support this scenario
// Does not support this scenario
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
assertEquals
(
initialTimeout
,
bean
.
getTimeout
());
...
@@ -407,7 +406,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -407,7 +406,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newTimeout
,
bean
.
getTimeout
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
assertEquals
(
newBatch
,
bean
.
getBatch
());
...
@@ -483,7 +482,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
...
@@ -483,7 +482,7 @@ public class XmlConfigPlaceholderAutoUpdateTest extends AbstractSpringIntegratio
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
config
.
onRepositoryChange
(
ConfigConsts
.
NAMESPACE_APPLICATION
,
newProperties
);
TimeUnit
.
MILLISECONDS
.
sleep
(
5
0
);
TimeUnit
.
MILLISECONDS
.
sleep
(
10
0
);
assertEquals
(
someNewInt
,
bean
.
getIntProperty
());
assertEquals
(
someNewInt
,
bean
.
getIntProperty
());
assertArrayEquals
(
someNewIntArray
,
bean
.
getIntArrayProperty
());
assertArrayEquals
(
someNewIntArray
,
bean
.
getIntArrayProperty
());
...
...
apollo-common/pom.xml
View file @
6b2467df
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<parent>
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
<relativePath>
../pom.xml
</relativePath>
<relativePath>
../pom.xml
</relativePath>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-configservice/pom.xml
View file @
6b2467df
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<parent>
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
<relativePath>
../pom.xml
</relativePath>
<relativePath>
../pom.xml
</relativePath>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-configservice/src/main/docker/Dockerfile
View file @
6b2467df
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
FROM
openjdk:8-jre-alpine
FROM
openjdk:8-jre-alpine
MAINTAINER
ameizi <sxyx2008@163.com>
MAINTAINER
ameizi <sxyx2008@163.com>
ENV
VERSION 0.10.
0
ENV
VERSION 0.10.
1
RUN
echo
"http://mirrors.aliyun.com/alpine/v3.6/main"
>
/etc/apk/repositories
\
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
\
&&
echo
"http://mirrors.aliyun.com/alpine/v3.6/community"
>>
/etc/apk/repositories
\
...
...
apollo-core/pom.xml
View file @
6b2467df
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<parent>
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
<relativePath>
../pom.xml
</relativePath>
<relativePath>
../pom.xml
</relativePath>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-demo/pom.xml
View file @
6b2467df
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<parent>
<parent>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-demo
</artifactId>
<artifactId>
apollo-demo
</artifactId>
...
...
apollo-portal/pom.xml
View file @
6b2467df
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<parent>
<parent>
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
<relativePath>
../pom.xml
</relativePath>
<relativePath>
../pom.xml
</relativePath>
</parent>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<modelVersion>
4.0.0
</modelVersion>
...
...
apollo-portal/src/main/docker/Dockerfile
View file @
6b2467df
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
FROM
openjdk:8-jre-alpine
FROM
openjdk:8-jre-alpine
MAINTAINER
ameizi <sxyx2008@163.com>
MAINTAINER
ameizi <sxyx2008@163.com>
ENV
VERSION 0.10.
0
ENV
VERSION 0.10.
1
RUN
echo
"http://mirrors.aliyun.com/alpine/v3.6/main"
>
/etc/apk/repositories
\
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
\
&&
echo
"http://mirrors.aliyun.com/alpine/v3.6/community"
>>
/etc/apk/repositories
\
...
...
pom.xml
View file @
6b2467df
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<groupId>
com.ctrip.framework.apollo
</groupId>
<groupId>
com.ctrip.framework.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<artifactId>
apollo
</artifactId>
<version>
0.10.
0
</version>
<version>
0.10.
1
</version>
<name>
Apollo
</name>
<name>
Apollo
</name>
<packaging>
pom
</packaging>
<packaging>
pom
</packaging>
<description>
Ctrip Configuration Center
</description>
<description>
Ctrip Configuration Center
</description>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment