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
4f653461
Commit
4f653461
authored
May 16, 2016
by
Yiming Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable local start config/admin/portal
parent
43434383
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
157 additions
and
13 deletions
+157
-13
AdminServiceApplication.java
...om/ctrip/apollo/adminservice/AdminServiceApplication.java
+2
-0
IndexController.java
...ctrip/apollo/adminservice/controller/IndexController.java
+14
-0
AdminServiceTestConfiguration.java
.../java/com/ctrip/apollo/AdminServiceTestConfiguration.java
+1
-1
LocalAdminServiceApplication.java
...t/java/com/ctrip/apollo/LocalAdminServiceApplication.java
+2
-2
ApolloApplication.java
...ain/java/com/ctrip/apollo/assembly/ApolloApplication.java
+0
-1
LocalApolloApplication.java
...ava/com/ctrip/apollo/assembly/LocalApolloApplication.java
+62
-0
application.properties
apollo-assembly/src/test/resources/application.properties
+6
-0
application.yml
apollo-assembly/src/test/resources/application.yml
+3
-0
logback-test.xml
apollo-assembly/src/test/resources/logback-test.xml
+16
-0
CharacterEncodingFilterConfiguration.java
...mmon/controller/CharacterEncodingFilterConfiguration.java
+25
-0
WebMvcConfig.java
...java/com/ctrip/apollo/common/controller/WebMvcConfig.java
+2
-2
application.properties
apollo-common/src/main/resources/application.properties
+2
-0
ConfigServiceApplication.java
.../ctrip/apollo/configservice/ConfigServiceApplication.java
+5
-2
ApolloMetaServiceConfig.java
...com/ctrip/apollo/metaservice/ApolloMetaServiceConfig.java
+12
-0
ConfigServiceTestConfiguration.java
...java/com/ctrip/apollo/ConfigServiceTestConfiguration.java
+1
-1
LocalConfigServiceApplication.java
.../java/com/ctrip/apollo/LocalConfigServiceApplication.java
+2
-2
LocalPortalApplication.java
...rc/test/java/com/ctrip/apollo/LocalPortalApplication.java
+2
-2
No files found.
apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/AdminServiceApplication.java
View file @
4f653461
...
...
@@ -10,12 +10,14 @@ import org.springframework.context.annotation.ComponentScan;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
@EnableAspectJAutoProxy
@EnableEurekaClient
@Configuration
@PropertySource
(
value
=
{
"classpath:adminservice.properties"
})
@EnableAutoConfiguration
@EnableTransactionManagement
@ComponentScan
(
basePackageClasses
=
{
com
.
ctrip
.
apollo
.
common
.
ApolloCommonConfig
.
class
,
com
.
ctrip
.
apollo
.
biz
.
ApolloBizConfig
.
class
,
com
.
ctrip
.
apollo
.
adminservice
.
AdminServiceApplication
.
class
})
...
...
apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/IndexController.java
0 → 100644
View file @
4f653461
package
com
.
ctrip
.
apollo
.
adminservice
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
path
=
"/"
)
public
class
IndexController
{
@RequestMapping
(
path
=
""
)
public
String
index
()
{
return
"apollo-adminservice"
;
}
}
apollo-adminservice/src/test/java/com/ctrip/apollo/AdminServiceTestConfiguration.java
View file @
4f653461
...
...
@@ -12,7 +12,7 @@ import com.ctrip.apollo.adminservice.AdminServiceApplication;
@Configuration
@ComponentScan
(
excludeFilters
=
{
@Filter
(
type
=
FilterType
.
ASSIGNABLE_TYPE
,
value
=
{
Sample
AdminServiceApplication
.
class
,
AdminServiceApplication
.
class
,
Local
AdminServiceApplication
.
class
,
AdminServiceApplication
.
class
,
HttpMessageConverterConfiguration
.
class
})})
@EnableAutoConfiguration
public
class
AdminServiceTestConfiguration
{
...
...
apollo-adminservice/src/test/java/com/ctrip/apollo/
Sample
AdminServiceApplication.java
→
apollo-adminservice/src/test/java/com/ctrip/apollo/
Local
AdminServiceApplication.java
View file @
4f653461
...
...
@@ -6,8 +6,8 @@ import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public
class
Sample
AdminServiceApplication
{
public
class
Local
AdminServiceApplication
{
public
static
void
main
(
String
[]
args
)
{
new
SpringApplicationBuilder
(
Sample
AdminServiceApplication
.
class
).
run
(
args
);
new
SpringApplicationBuilder
(
Local
AdminServiceApplication
.
class
).
run
(
args
);
}
}
apollo-assembly/src/main/java/com/ctrip/apollo/assembly/ApolloApplication.java
View file @
4f653461
...
...
@@ -3,7 +3,6 @@ package com.ctrip.apollo.assembly;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.actuate.system.ApplicationPidFileWriter
;
import
org.springframework.boot.actuate.system.EmbeddedServerPortFileWriter
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
;
...
...
apollo-assembly/src/test/java/com/ctrip/apollo/assembly/LocalApolloApplication.java
0 → 100644
View file @
4f653461
package
com
.
ctrip
.
apollo
.
assembly
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.actuate.system.ApplicationPidFileWriter
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.cloud.context.scope.refresh.RefreshScope
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
com.ctrip.apollo.adminservice.AdminServiceApplication
;
import
com.ctrip.apollo.configservice.ConfigServiceApplication
;
import
com.ctrip.apollo.portal.PortalApplication
;
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
,
HibernateJpaAutoConfiguration
.
class
})
public
class
LocalApolloApplication
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApolloApplication
.
class
);
public
static
void
main
(
String
[]
args
)
throws
Exception
{
/**
* Common
*/
ConfigurableApplicationContext
commonContext
=
new
SpringApplicationBuilder
(
ApolloApplication
.
class
).
web
(
false
).
run
(
args
);
commonContext
.
addApplicationListener
(
new
ApplicationPidFileWriter
());
logger
.
info
(
commonContext
.
getId
()
+
" isActive: "
+
commonContext
.
isActive
());
/**
* ConfigService
*/
if
(
commonContext
.
getEnvironment
().
containsProperty
(
"configservice"
))
{
ConfigurableApplicationContext
configContext
=
new
SpringApplicationBuilder
(
ConfigServiceApplication
.
class
).
parent
(
commonContext
)
.
sources
(
RefreshScope
.
class
).
run
(
args
);
logger
.
info
(
configContext
.
getId
()
+
" isActive: "
+
configContext
.
isActive
());
}
/**
* AdminService
*/
if
(
commonContext
.
getEnvironment
().
containsProperty
(
"adminservice"
))
{
ConfigurableApplicationContext
adminContext
=
new
SpringApplicationBuilder
(
AdminServiceApplication
.
class
).
parent
(
commonContext
)
.
sources
(
RefreshScope
.
class
).
run
(
args
);
logger
.
info
(
adminContext
.
getId
()
+
" isActive: "
+
adminContext
.
isActive
());
}
/**
* Portal
*/
if
(
commonContext
.
getEnvironment
().
containsProperty
(
"portal"
))
{
ConfigurableApplicationContext
portalContext
=
new
SpringApplicationBuilder
(
PortalApplication
.
class
).
parent
(
commonContext
).
run
(
args
);
logger
.
info
(
portalContext
.
getId
()
+
" isActive: "
+
portalContext
.
isActive
());
}
}
}
apollo-assembly/src/test/resources/application.properties
0 → 100644
View file @
4f653461
spring.datasource.url
=
jdbc:h2:mem:~/apolloconfigdb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE
spring.jpa.hibernate.naming_strategy
=
org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.properties.hibernate.show_sql
=
true
spring.h2.console.enabled
=
true
spring.h2.console.settings.web-allow-others
=
true
apollo.portal.env
=
local
apollo-assembly/src/test/resources/application.yml
0 → 100644
View file @
4f653461
spring
:
profiles
:
active
:
local
apollo-assembly/src/test/resources/logback-test.xml
0 → 100644
View file @
4f653461
<?xml version="1.0" encoding="UTF-8"?>
<configuration
scan=
"true"
>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<charset>
utf-8
</charset>
<Pattern>
[%p] %c - %m%n
</Pattern>
</encoder>
</appender>
<logger
name=
"org.springframework.test"
level=
"OFF"
/>
<root
level=
"INFO"
>
<appender-ref
ref=
"CONSOLE"
/>
</root>
</configuration>
\ No newline at end of file
apollo-common/src/main/java/com/ctrip/apollo/common/controller/CharacterEncodingFilterConfiguration.java
0 → 100644
View file @
4f653461
package
com
.
ctrip
.
apollo
.
common
.
controller
;
import
javax.servlet.DispatcherType
;
import
org.springframework.boot.context.embedded.FilterRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.filter.CharacterEncodingFilter
;
@Configuration
public
class
CharacterEncodingFilterConfiguration
{
@Bean
public
FilterRegistrationBean
encodingFilter
()
{
FilterRegistrationBean
bean
=
new
FilterRegistrationBean
();
bean
.
setFilter
(
new
CharacterEncodingFilter
());
bean
.
addInitParameter
(
"encoding"
,
"UTF-8"
);
//FIXME: https://github.com/Netflix/eureka/issues/702
// bean.addInitParameter("forceEncoding", "true");
bean
.
setName
(
"encodingFilter"
);
bean
.
addUrlPatterns
(
"/*"
);
bean
.
setDispatcherTypes
(
DispatcherType
.
REQUEST
,
DispatcherType
.
FORWARD
);
return
bean
;
}
}
apollo-common/src/main/java/com/ctrip/apollo/common/controller/WebMvcConfig.java
View file @
4f653461
package
com
.
ctrip
.
apollo
.
common
.
controller
;
import
java.util.List
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.web.PageableHandlerMethodArgumentResolver
;
...
...
@@ -8,8 +10,6 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import
org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
import
java.util.List
;
@Configuration
public
class
WebMvcConfig
extends
WebMvcConfigurerAdapter
{
...
...
apollo-common/src/main/resources/application.properties
0 → 100644
View file @
4f653461
spring.http.converters.preferred-json-mapper
=
gson
\ No newline at end of file
apollo-configservice/src/main/java/com/ctrip/apollo/configservice/ConfigServiceApplication.java
View file @
4f653461
...
...
@@ -10,6 +10,7 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
/**
* Spring boot application entry point
...
...
@@ -19,12 +20,14 @@ import org.springframework.context.annotation.PropertySource;
@EnableEurekaServer
@EnableAspectJAutoProxy
@EnableAutoConfiguration
//
(exclude = EurekaClientConfigBean.class)
@EnableAutoConfiguration
//
(exclude = EurekaClientConfigBean.class)
@Configuration
@EnableTransactionManagement
@PropertySource
(
value
=
{
"classpath:configservice.properties"
})
@ComponentScan
(
basePackageClasses
=
{
com
.
ctrip
.
apollo
.
common
.
ApolloCommonConfig
.
class
,
com
.
ctrip
.
apollo
.
biz
.
ApolloBizConfig
.
class
,
com
.
ctrip
.
apollo
.
configservice
.
ConfigServiceApplication
.
class
})
com
.
ctrip
.
apollo
.
configservice
.
ConfigServiceApplication
.
class
,
com
.
ctrip
.
apollo
.
metaservice
.
ApolloMetaServiceConfig
.
class
})
public
class
ConfigServiceApplication
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
...
apollo-configservice/src/main/java/com/ctrip/apollo/metaservice/ApolloMetaServiceConfig.java
0 → 100644
View file @
4f653461
package
com
.
ctrip
.
apollo
.
metaservice
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
@EnableAutoConfiguration
@Configuration
@ComponentScan
(
basePackageClasses
=
com
.
ctrip
.
apollo
.
metaservice
.
ApolloMetaServiceConfig
.
class
)
public
class
ApolloMetaServiceConfig
{
}
apollo-configservice/src/test/java/com/ctrip/apollo/ConfigServiceTestConfiguration.java
View file @
4f653461
...
...
@@ -11,7 +11,7 @@ import org.springframework.context.annotation.FilterType;
@Configuration
@ComponentScan
(
excludeFilters
=
{
@Filter
(
type
=
FilterType
.
ASSIGNABLE_TYPE
,
value
=
{
Sample
ConfigServiceApplication
.
class
,
ConfigServiceApplication
.
class
,
WebSecurityConfig
.
class
})})
Local
ConfigServiceApplication
.
class
,
ConfigServiceApplication
.
class
,
WebSecurityConfig
.
class
})})
@EnableAutoConfiguration
public
class
ConfigServiceTestConfiguration
{
...
...
apollo-configservice/src/test/java/com/ctrip/apollo/
Sample
ConfigServiceApplication.java
→
apollo-configservice/src/test/java/com/ctrip/apollo/
Local
ConfigServiceApplication.java
View file @
4f653461
...
...
@@ -6,8 +6,8 @@ import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public
class
Sample
ConfigServiceApplication
{
public
class
Local
ConfigServiceApplication
{
public
static
void
main
(
String
[]
args
)
{
new
SpringApplicationBuilder
(
Sample
ConfigServiceApplication
.
class
).
run
(
args
);
new
SpringApplicationBuilder
(
Local
ConfigServiceApplication
.
class
).
run
(
args
);
}
}
apollo-portal/src/test/java/com/ctrip/apollo/
Sample
PortalApplication.java
→
apollo-portal/src/test/java/com/ctrip/apollo/
Local
PortalApplication.java
View file @
4f653461
...
...
@@ -4,8 +4,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
@SpringBootApplication
public
class
Sample
PortalApplication
{
public
class
Local
PortalApplication
{
public
static
void
main
(
String
[]
args
)
{
new
SpringApplicationBuilder
(
Sample
PortalApplication
.
class
).
run
(
args
);
new
SpringApplicationBuilder
(
Local
PortalApplication
.
class
).
run
(
args
);
}
}
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