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
9683e5b7
Commit
9683e5b7
authored
Jul 25, 2017
by
nobodyiam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify spring demo
parent
84053f70
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
82 additions
and
166 deletions
+82
-166
AnnotatedBean.java
...amework/apollo/demo/spring/common/bean/AnnotatedBean.java
+8
-39
RefreshScopeBean.java
...work/apollo/demo/spring/common/bean/RefreshScopeBean.java
+0
-38
AppConfig.java
...framework/apollo/demo/spring/common/config/AppConfig.java
+0
-11
ApolloRefreshConfig.java
...pollo/demo/spring/common/refresh/ApolloRefreshConfig.java
+13
-34
RefreshScopeConfig.java
...demo/spring/javaConfigDemo/config/RefreshScopeConfig.java
+0
-3
SampleRedisConfig.java
.../demo/spring/springBootDemo/config/SampleRedisConfig.java
+2
-5
SpringBootApolloRefreshConfig.java
...springBootDemo/refresh/SpringBootApolloRefreshConfig.java
+5
-17
XmlBean.java
...mework/apollo/demo/spring/xmlConfigDemo/bean/XmlBean.java
+13
-14
ManualRefreshUtil.java
.../demo/spring/xmlConfigDemo/refresh/ManualRefreshUtil.java
+37
-0
spring.xml
apollo-demo/src/main/resources/spring.xml
+4
-5
No files found.
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/common/bean/AnnotatedBean.java
View file @
9683e5b7
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
common
.
bean
;
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
common
.
bean
;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.model.ConfigChange
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfig
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cloud.context.config.annotation.RefreshScope
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.PostConstruct
;
...
@@ -16,7 +11,8 @@ import javax.annotation.PostConstruct;
...
@@ -16,7 +11,8 @@ import javax.annotation.PostConstruct;
/**
/**
* @author Jason Song(song_s@ctrip.com)
* @author Jason Song(song_s@ctrip.com)
*/
*/
@Component
@RefreshScope
@Component
(
"annotatedBean"
)
public
class
AnnotatedBean
{
public
class
AnnotatedBean
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AnnotatedBean
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AnnotatedBean
.
class
);
...
@@ -24,18 +20,10 @@ public class AnnotatedBean {
...
@@ -24,18 +20,10 @@ public class AnnotatedBean {
private
int
timeout
;
private
int
timeout
;
private
int
batch
;
private
int
batch
;
@ApolloConfig
private
Config
config
;
@ApolloConfig
(
"FX.apollo"
)
private
Config
anotherConfig
;
@PostConstruct
@PostConstruct
void
initialize
()
{
void
initialize
()
{
logger
.
info
(
"timeout is {}"
,
timeout
);
logger
.
info
(
"timeout is initialized as {}"
,
timeout
);
logger
.
info
(
"batch is {}"
,
batch
);
logger
.
info
(
"batch is initialized as {}"
,
batch
);
logger
.
info
(
"Keys for config: {}"
,
config
.
getPropertyNames
());
logger
.
info
(
"Keys for anotherConfig: {}"
,
anotherConfig
.
getPropertyNames
());
}
}
@Value
(
"${batch:100}"
)
@Value
(
"${batch:100}"
)
...
@@ -43,28 +31,9 @@ public class AnnotatedBean {
...
@@ -43,28 +31,9 @@ public class AnnotatedBean {
this
.
batch
=
batch
;
this
.
batch
=
batch
;
}
}
@ApolloConfigChangeListener
(
"application"
)
private
void
someChangeHandler
(
ConfigChangeEvent
changeEvent
)
{
logger
.
info
(
"[someChangeHandler]Changes for namespace {}"
,
changeEvent
.
getNamespace
());
if
(
changeEvent
.
isChanged
(
"timeout"
))
{
refreshTimeout
();
}
}
@ApolloConfigChangeListener
({
"application"
,
"FX.apollo"
})
private
void
anotherChangeHandler
(
ConfigChangeEvent
changeEvent
)
{
logger
.
info
(
"[anotherChangeHandler]Changes for namespace {}"
,
changeEvent
.
getNamespace
());
for
(
String
key
:
changeEvent
.
changedKeys
())
{
ConfigChange
change
=
changeEvent
.
getChange
(
key
);
logger
.
info
(
"[anotherChangeHandler]Change - key: {}, oldValue: {}, newValue: {}, changeType: {}"
,
change
.
getPropertyName
(),
change
.
getOldValue
(),
change
.
getNewValue
(),
change
.
getChangeType
());
}
}
private
void
refreshTimeout
()
{
@Override
//do some custom logic to update placeholder value
public
String
toString
()
{
timeout
=
config
.
getIntProperty
(
"timeout"
,
timeout
);
return
String
.
format
(
"[AnnotatedBean] timeout: %d, batch: %d"
,
timeout
,
batch
);
logger
.
info
(
"Refreshing timeout to {}"
,
timeout
);
}
}
}
}
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/common/bean/RefreshScopeBean.java
deleted
100644 → 0
View file @
84053f70
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
common
.
bean
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cloud.context.config.annotation.RefreshScope
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
/**
* This bean is annotated with @RefreshScope so that it can be 'refreshed' at runtime
* @author Jason Song(song_s@ctrip.com)
*/
@RefreshScope
@Component
(
"refreshScopeBean"
)
public
class
RefreshScopeBean
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RefreshScopeBean
.
class
);
@Value
(
"${timeout:200}"
)
private
int
timeout
;
@Value
(
"${batch:100}"
)
private
int
batch
;
/**
* this method will be called when the bean is first initialized, and when it is 'refreshed' as well
*/
@PostConstruct
void
initialize
()
{
logger
.
info
(
"timeout is {}"
,
timeout
);
logger
.
info
(
"batch is {}"
,
batch
);
}
@Override
public
String
toString
()
{
return
String
.
format
(
"[RefreshScopeBean] timeout: %d, batch: %d"
,
timeout
,
batch
);
}
}
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/common/config/AppConfig.java
View file @
9683e5b7
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
common
.
config
;
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
common
.
config
;
import
com.ctrip.framework.apollo.demo.spring.common.bean.NormalBean
;
import
com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig
;
import
com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cloud.context.config.annotation.RefreshScope
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
/**
/**
...
@@ -14,11 +10,4 @@ import org.springframework.context.annotation.Configuration;
...
@@ -14,11 +10,4 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@Configuration
@EnableApolloConfig
(
value
=
"application"
,
order
=
10
)
@EnableApolloConfig
(
value
=
"application"
,
order
=
10
)
public
class
AppConfig
{
public
class
AppConfig
{
@Bean
(
"normalBean"
)
@RefreshScope
public
NormalBean
normalBean
(
@Value
(
"${batch:100}"
)
int
batch
)
{
NormalBean
bean
=
new
NormalBean
();
bean
.
setBatch
(
batch
);
return
bean
;
}
}
}
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/common/refresh/ApolloRefreshConfig.java
View file @
9683e5b7
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
common
.
refresh
;
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
common
.
refresh
;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.demo.spring.common.bean.AnnotatedBean
;
import
com.ctrip.framework.apollo.ConfigChangeListener
;
import
com.ctrip.framework.apollo.demo.spring.common.bean.NormalBean
;
import
com.ctrip.framework.apollo.demo.spring.common.bean.RefreshScopeBean
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfig
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfig
ChangeListener
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.cloud.context.scope.refresh.RefreshScope
;
import
org.springframework.cloud.context.scope.refresh.RefreshScope
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
/**
/**
* To refresh the config bean when config is changed
* To refresh the config bean when config is changed
*
*
* @author Jason Song(song_s@ctrip.com)
* @author Jason Song(song_s@ctrip.com)
*/
*/
@Component
@Component
public
class
ApolloRefreshConfig
implements
ConfigChangeListener
{
public
class
ApolloRefreshConfig
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApolloRefreshConfig
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApolloRefreshConfig
.
class
);
@ApolloConfig
private
Config
config
;
@ApolloConfig
(
"FX.apollo"
)
private
Config
anotherConfig
;
@Autowired
@Autowired
private
RefreshScope
refreshScope
;
private
RefreshScope
refreshScope
;
@Autowired
@Autowired
private
RefreshScopeBean
refreshScopeBean
;
private
AnnotatedBean
annotatedBean
;
@Autowired
@ApolloConfigChangeListener
({
"application"
,
"FX.apollo"
})
private
NormalBean
normalBean
;
private
void
onChange
(
ConfigChangeEvent
changeEvent
)
{
if
(
changeEvent
.
isChanged
(
"timeout"
)
||
changeEvent
.
isChanged
(
"batch"
))
{
@PostConstruct
logger
.
info
(
"before refresh {}"
,
annotatedBean
.
toString
());
private
void
init
()
{
//could also call refreshScope.refreshAll();
config
.
addChangeListener
(
this
);
refreshScope
.
refresh
(
"annotatedBean"
);
anotherConfig
.
addChangeListener
(
this
);
logger
.
info
(
"after refresh {}"
,
annotatedBean
.
toString
());
}
}
@Override
public
void
onChange
(
ConfigChangeEvent
changeEvent
)
{
//could also call refreshScope.refreshAll();
logger
.
info
(
"refreshScopeBean before refresh {}"
,
refreshScopeBean
.
toString
());
//could also call refreshScope.refreshAll();
refreshScope
.
refresh
(
"refreshScopeBean"
);
logger
.
info
(
"refreshScopeBean after refresh {}"
,
refreshScopeBean
.
toString
());
logger
.
info
(
"normalBean with refresh scope before refresh {}"
,
normalBean
.
toString
());
refreshScope
.
refresh
(
"normalBean"
);
logger
.
info
(
"normalBean with refresh scope after refresh {}"
,
normalBean
.
toString
());
}
}
}
}
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/javaConfigDemo/config/RefreshScopeConfig.java
View file @
9683e5b7
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
javaConfigDemo
.
config
;
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
javaConfigDemo
.
config
;
import
com.ctrip.framework.apollo.demo.spring.common.refresh.ApolloRefreshConfig
;
import
org.springframework.cloud.autoconfigure.RefreshAutoConfiguration
;
import
org.springframework.cloud.autoconfigure.RefreshAutoConfiguration
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
...
...
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/springBootDemo/config/SampleRedisConfig.java
View file @
9683e5b7
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
springBootDemo
.
config
;
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
springBootDemo
.
config
;
import
com.ctrip.framework.apollo.ConfigChangeListener
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
...
@@ -25,8 +22,8 @@ public class SampleRedisConfig {
...
@@ -25,8 +22,8 @@ public class SampleRedisConfig {
private
int
commandTimeout
;
private
int
commandTimeout
;
@PostConstruct
@PostConstruct
private
void
init
()
{
private
void
init
ialize
()
{
logger
.
info
(
"
ConfigurationProperties sample
- expireSeconds: {}, clusterNodes: {}, commandTimeout: {}"
,
logger
.
info
(
"
SampleRedisConfig initialized
- expireSeconds: {}, clusterNodes: {}, commandTimeout: {}"
,
expireSeconds
,
clusterNodes
,
commandTimeout
);
expireSeconds
,
clusterNodes
,
commandTimeout
);
}
}
...
...
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/springBootDemo/refresh/SpringBootApolloRefreshConfig.java
View file @
9683e5b7
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
springBootDemo
.
refresh
;
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
springBootDemo
.
refresh
;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.ConfigChangeListener
;
import
com.ctrip.framework.apollo.demo.spring.common.refresh.ApolloRefreshConfig
;
import
com.ctrip.framework.apollo.demo.spring.common.refresh.ApolloRefreshConfig
;
import
com.ctrip.framework.apollo.demo.spring.springBootDemo.config.SampleRedisConfig
;
import
com.ctrip.framework.apollo.demo.spring.springBootDemo.config.SampleRedisConfig
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfig
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfig
ChangeListener
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -13,13 +11,11 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -13,13 +11,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.cloud.context.scope.refresh.RefreshScope
;
import
org.springframework.cloud.context.scope.refresh.RefreshScope
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
/**
/**
* @author Jason Song(song_s@ctrip.com)
* @author Jason Song(song_s@ctrip.com)
*/
*/
@Component
@Component
public
class
SpringBootApolloRefreshConfig
implements
ConfigChangeListener
{
public
class
SpringBootApolloRefreshConfig
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SpringBootApolloRefreshConfig
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SpringBootApolloRefreshConfig
.
class
);
@Autowired
@Autowired
...
@@ -28,21 +24,13 @@ public class SpringBootApolloRefreshConfig implements ConfigChangeListener {
...
@@ -28,21 +24,13 @@ public class SpringBootApolloRefreshConfig implements ConfigChangeListener {
@Autowired
@Autowired
private
SampleRedisConfig
sampleRedisConfig
;
private
SampleRedisConfig
sampleRedisConfig
;
@ApolloConfig
private
Config
config
;
@Autowired
@Autowired
private
RefreshScope
refreshScope
;
private
RefreshScope
refreshScope
;
@PostConstruct
@ApolloConfigChangeListener
private
void
init
()
{
config
.
addChangeListener
(
this
);
}
@Override
public
void
onChange
(
ConfigChangeEvent
changeEvent
)
{
public
void
onChange
(
ConfigChangeEvent
changeEvent
)
{
logger
.
info
(
"
sampleRedisConfig
before refresh {}"
,
sampleRedisConfig
.
toString
());
logger
.
info
(
"before refresh {}"
,
sampleRedisConfig
.
toString
());
refreshScope
.
refresh
(
"sampleRedisConfig"
);
refreshScope
.
refresh
(
"sampleRedisConfig"
);
logger
.
info
(
"
sampleRedisConfig
after refresh {}"
,
sampleRedisConfig
.
toString
());
logger
.
info
(
"after refresh {}"
,
sampleRedisConfig
.
toString
());
}
}
}
}
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/
common/bean/Norma
lBean.java
→
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/
xmlConfigDemo/bean/Xm
lBean.java
View file @
9683e5b7
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
common
.
bean
;
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
xmlConfigDemo
.
bean
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
javax.annotation.PostConstruct
;
/**
/**
* @author Jason Song(song_s@ctrip.com)
* @author Jason Song(song_s@ctrip.com)
*/
*/
public
class
Norma
lBean
{
public
class
Xm
lBean
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Norma
lBean
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
Xm
lBean
.
class
);
@Value
(
"${timeout:200}"
)
private
int
timeout
;
private
int
timeout
;
private
int
batch
;
private
int
batch
;
@PostConstruct
public
void
setTimeout
(
int
timeout
)
{
void
initialize
()
{
logger
.
info
(
"updating timeout, old value: {}, new value: {}"
,
this
.
timeout
,
timeout
);
logger
.
info
(
"timeout is {}"
,
timeout
);
this
.
timeout
=
timeout
;
logger
.
info
(
"batch is {}"
,
batch
);
}
}
public
void
setBatch
(
int
batch
)
{
public
void
setBatch
(
int
batch
)
{
logger
.
info
(
"updating batch, old value: {}, new value: {}"
,
this
.
batch
,
batch
);
this
.
batch
=
batch
;
this
.
batch
=
batch
;
}
}
@Override
public
int
getTimeout
()
{
public
String
toString
()
{
return
timeout
;
return
String
.
format
(
"[NormalBean] timeout: %d, batch: %d"
,
timeout
,
batch
);
}
public
int
getBatch
()
{
return
batch
;
}
}
}
}
apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/xmlConfigDemo/refresh/ManualRefreshUtil.java
0 → 100644
View file @
9683e5b7
package
com
.
ctrip
.
framework
.
apollo
.
demo
.
spring
.
xmlConfigDemo
.
refresh
;
import
com.ctrip.framework.apollo.Config
;
import
com.ctrip.framework.apollo.demo.spring.xmlConfigDemo.bean.XmlBean
;
import
com.ctrip.framework.apollo.model.ConfigChangeEvent
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfig
;
import
com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public
class
ManualRefreshUtil
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ManualRefreshUtil
.
class
);
@ApolloConfig
private
Config
config
;
@Autowired
private
XmlBean
xmlBean
;
@ApolloConfigChangeListener
private
void
onChange
(
ConfigChangeEvent
changeEvent
)
{
if
(
changeEvent
.
isChanged
(
"timeout"
))
{
logger
.
info
(
"Manually refreshing xmlBean.timeout"
);
xmlBean
.
setTimeout
(
config
.
getIntProperty
(
"timeout"
,
xmlBean
.
getTimeout
()));
}
if
(
changeEvent
.
isChanged
(
"batch"
))
{
logger
.
info
(
"Manually refreshing xmlBean.batch"
);
xmlBean
.
setBatch
(
config
.
getIntProperty
(
"batch"
,
xmlBean
.
getBatch
()));
}
}
}
apollo-demo/src/main/resources/spring.xml
View file @
9683e5b7
...
@@ -2,21 +2,20 @@
...
@@ -2,21 +2,20 @@
<beans
xmlns=
"http://www.springframework.org/schema/beans"
<beans
xmlns=
"http://www.springframework.org/schema/beans"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xmlns:context=
"http://www.springframework.org/schema/context"
xmlns:context=
"http://www.springframework.org/schema/context"
xmlns:aop=
"http://www.springframework.org/schema/aop"
xmlns:apollo=
"http://www.ctrip.com/schema/apollo"
xmlns:apollo=
"http://www.ctrip.com/schema/apollo"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"
>
http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"
>
<apollo:config
order=
"10"
/>
<apollo:config
order=
"10"
/>
<apollo:config
namespaces=
"FX.apollo"
order=
"11"
/>
<apollo:config
namespaces=
"FX.apollo"
order=
"11"
/>
<bean
name=
"normalBean"
id=
"normalBean"
class=
"com.ctrip.framework.apollo.demo.spring.common.bean.NormalBean"
<bean
class=
"com.ctrip.framework.apollo.demo.spring.xmlConfigDemo.bean.XmlBean"
>
scope=
"refresh"
>
<property
name=
"timeout"
value=
"${timeout:200}"
/>
<aop:scoped-proxy
proxy-target-class=
"true"
/>
<property
name=
"batch"
value=
"${batch:100}"
/>
<property
name=
"batch"
value=
"${batch:100}"
/>
</bean>
</bean>
<bean
class=
"com.ctrip.framework.apollo.demo.spring.xmlConfigDemo.refresh.ManualRefreshUtil"
/>
<!-- to support RefreshScope -->
<!-- to support RefreshScope -->
<bean
class=
"org.springframework.cloud.autoconfigure.RefreshAutoConfiguration"
/>
<bean
class=
"org.springframework.cloud.autoconfigure.RefreshAutoConfiguration"
/>
...
...
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