Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wrr-cat
apollo
提交
05f3a9c8
apollo
项目概览
wrr-cat
/
apollo
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
apollo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
05f3a9c8
编写于
4月 07, 2016
作者:
Y
Yiming Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Force REST return json format
上级
7bc2ffa8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
142 addition
and
107 deletion
+142
-107
apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/WebMvcConfig.java
...om/ctrip/apollo/adminservice/controller/WebMvcConfig.java
+7
-0
apollo-adminservice/src/test/resources/import.sql
apollo-adminservice/src/test/resources/import.sql
+14
-14
apollo-biz/pom.xml
apollo-biz/pom.xml
+4
-9
apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Release.java
...iz/src/main/java/com/ctrip/apollo/biz/entity/Release.java
+2
-0
apollo-biz/src/test/resources/import.sql
apollo-biz/src/test/resources/import.sql
+10
-10
apollo-configservice/pom.xml
apollo-configservice/pom.xml
+74
-74
apollo-configservice/src/main/java/com/ctrip/apollo/configservice/controller/WebMvcConfig.java
...m/ctrip/apollo/configservice/controller/WebMvcConfig.java
+31
-0
未找到文件。
apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/WebMvcConfig.java
浏览文件 @
05f3a9c8
...
...
@@ -5,7 +5,9 @@ import java.util.List;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.web.PageableHandlerMethodArgumentResolver
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
import
org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
...
...
@@ -21,4 +23,9 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
argumentResolvers
.
add
(
resolver
);
}
@Override
public
void
configureContentNegotiation
(
ContentNegotiationConfigurer
configurer
)
{
configurer
.
ignoreAcceptHeader
(
true
).
defaultContentType
(
MediaType
.
APPLICATION_JSON
);
}
}
apollo-adminservice/src/test/resources/import.sql
浏览文件 @
05f3a9c8
...
...
@@ -11,21 +11,21 @@ INSERT INTO Cluster (AppId, Name) VALUES ('100003173', 'default');
INSERT
INTO
Cluster
(
AppId
,
Name
)
VALUES
(
'100003173'
,
'cluster3'
);
INSERT
INTO
Cluster
(
AppId
,
Name
)
VALUES
(
'fxhermesproducer'
,
'default'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003171'
,
'ap
ollo-config-service
'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003172'
,
'ap
ollo-admin-service
'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003173'
,
'ap
ollo-portal-service
'
);
INSERT
INTO
AppNamespace
(
AppID
,
Name
)
VALUES
(
'fxhermesproducer'
,
'
fx-hermes-producer
'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003171'
,
'ap
plication
'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003172'
,
'ap
plication
'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003173'
,
'ap
plication
'
);
INSERT
INTO
AppNamespace
(
AppID
,
Name
)
VALUES
(
'fxhermesproducer'
,
'
application
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
1
,
'100003171'
,
'default'
,
'ap
ollo-config-service
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
2
,
'fxhermesproducer'
,
'default'
,
'
fx-hermes-producer
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
3
,
'100003172'
,
'default'
,
'ap
ollo-admin-service
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
4
,
'100003173'
,
'default'
,
'ap
ollo-portal
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
5
,
'100003171'
,
'default'
,
'
fx-hermes-producer
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
1
,
'100003171'
,
'default'
,
'ap
plication
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
2
,
'fxhermesproducer'
,
'default'
,
'
application
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
3
,
'100003172'
,
'default'
,
'ap
plication
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
4
,
'100003173'
,
'default'
,
'ap
plication
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
5
,
'100003171'
,
'default'
,
'
application
'
);
INSERT
INTO
Item
(
Namespace
Id
,
`Key`
,
Value
,
Comment
)
VALUES
(
1
,
'k1'
,
'v1'
,
'comment1'
);
INSERT
INTO
Item
(
Namespace
Id
,
`Key`
,
Value
,
Comment
)
VALUES
(
1
,
'k2'
,
'v2'
,
'comment2'
);
INSERT
INTO
Item
(
Namespace
Id
,
`Key`
,
Value
,
Comment
)
VALUES
(
2
,
'k3'
,
'v3'
,
'comment3'
);
INSERT
INTO
Item
(
Namespace
Id
,
`Key`
,
Value
,
Comment
)
VALUES
(
5
,
'k3'
,
'v4'
,
'comment4'
);
INSERT
INTO
Item
(
Group
Id
,
`Key`
,
Value
,
Comment
)
VALUES
(
1
,
'k1'
,
'v1'
,
'comment1'
);
INSERT
INTO
Item
(
Group
Id
,
`Key`
,
Value
,
Comment
)
VALUES
(
1
,
'k2'
,
'v2'
,
'comment2'
);
INSERT
INTO
Item
(
Group
Id
,
`Key`
,
Value
,
Comment
)
VALUES
(
2
,
'k3'
,
'v3'
,
'comment3'
);
INSERT
INTO
Item
(
Group
Id
,
`Key`
,
Value
,
Comment
)
VALUES
(
5
,
'k3'
,
'v4'
,
'comment4'
);
INSERT
INTO
`RELEASE`
(
Name
,
Comment
,
AppId
,
ClusterName
,
NamespaceName
,
Configurations
)
VALUES
(
'REV1'
,
'First Release'
,
'100003171'
,
'default'
,
'ap
ollo-config-service
'
,
'{"k1":"v1"}'
);
INSERT
INTO
`RELEASE`
(
Name
,
Comment
,
AppId
,
ClusterName
,
NamespaceName
,
Configurations
)
VALUES
(
'REV1'
,
'First Release'
,
'100003171'
,
'default'
,
'ap
plication
'
,
'{"k1":"v1"}'
);
apollo-biz/pom.xml
浏览文件 @
05f3a9c8
...
...
@@ -20,6 +20,10 @@
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
...
...
@@ -34,14 +38,5 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>
ctrip
</id>
<dependencies>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
apollo-biz/src/main/java/com/ctrip/apollo/biz/entity/Release.java
浏览文件 @
05f3a9c8
...
...
@@ -3,6 +3,7 @@ package com.ctrip.apollo.biz.entity;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Lob
;
import
javax.persistence.Table
;
import
org.hibernate.annotations.SQLDelete
;
import
org.hibernate.annotations.Where
;
...
...
@@ -11,6 +12,7 @@ import org.hibernate.annotations.Where;
* @author Jason Song(song_s@ctrip.com)
*/
@Entity
@Table
(
name
=
"\"Release\""
)
@SQLDelete
(
sql
=
"Update Release set isDeleted = 'false' where id = ?"
)
@Where
(
clause
=
"isDeleted = 'false'"
)
public
class
Release
extends
BaseEntity
{
...
...
apollo-biz/src/test/resources/import.sql
浏览文件 @
05f3a9c8
...
...
@@ -11,21 +11,21 @@ INSERT INTO Cluster (AppId, Name) VALUES ('100003173', 'default');
INSERT
INTO
Cluster
(
AppId
,
Name
)
VALUES
(
'100003173'
,
'cluster3'
);
INSERT
INTO
Cluster
(
AppId
,
Name
)
VALUES
(
'fxhermesproducer'
,
'default'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003171'
,
'ap
ollo-config-service
'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003172'
,
'ap
ollo-admin-service
'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003173'
,
'ap
ollo-portal-service
'
);
INSERT
INTO
AppNamespace
(
AppID
,
Name
)
VALUES
(
'fxhermesproducer'
,
'
fx-hermes-producer
'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003171'
,
'ap
plication
'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003172'
,
'ap
plication
'
);
INSERT
INTO
AppNamespace
(
AppId
,
Name
)
VALUES
(
'100003173'
,
'ap
plication
'
);
INSERT
INTO
AppNamespace
(
AppID
,
Name
)
VALUES
(
'fxhermesproducer'
,
'
application
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
1
,
'100003171'
,
'default'
,
'ap
ollo-config-service
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
2
,
'fxhermesproducer'
,
'default'
,
'
fx-hermes-producer
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
3
,
'100003172'
,
'default'
,
'ap
ollo-admin-service
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
4
,
'100003173'
,
'default'
,
'ap
ollo-portal
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
5
,
'100003171'
,
'default'
,
'
fx-hermes-producer
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
1
,
'100003171'
,
'default'
,
'ap
plication
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
2
,
'fxhermesproducer'
,
'default'
,
'
application
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
3
,
'100003172'
,
'default'
,
'ap
plication
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
4
,
'100003173'
,
'default'
,
'ap
plication
'
);
INSERT
INTO
Namespace
(
Id
,
AppId
,
ClusterName
,
NamespaceName
)
VALUES
(
5
,
'100003171'
,
'default'
,
'
application
'
);
INSERT
INTO
Item
(
GroupId
,
`Key`
,
Value
,
Comment
)
VALUES
(
1
,
'k1'
,
'v1'
,
'comment1'
);
INSERT
INTO
Item
(
GroupId
,
`Key`
,
Value
,
Comment
)
VALUES
(
1
,
'k2'
,
'v2'
,
'comment2'
);
INSERT
INTO
Item
(
GroupId
,
`Key`
,
Value
,
Comment
)
VALUES
(
2
,
'k3'
,
'v3'
,
'comment3'
);
INSERT
INTO
Item
(
GroupId
,
`Key`
,
Value
,
Comment
)
VALUES
(
5
,
'k3'
,
'v4'
,
'comment4'
);
INSERT
INTO
`RELEASE`
(
Name
,
Comment
,
AppId
,
ClusterName
,
GroupName
,
Configurations
)
VALUES
(
'REV1'
,
'First Release'
,
'100003171'
,
'default'
,
'apollo-config-service
'
,
'{"k1":"v1"}'
);
INSERT
INTO
`RELEASE`
(
Name
,
Comment
,
AppId
,
ClusterName
,
NamespaceName
,
Configurations
)
VALUES
(
'REV1'
,
'First Release'
,
'100003171'
,
'default'
,
'application
'
,
'{"k1":"v1"}'
);
apollo-configservice/pom.xml
浏览文件 @
05f3a9c8
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<parent>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-configservice
</artifactId>
<name>
Apollo ConfigService
</name>
<dependencies>
<!-- apollo -->
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo-biz
</artifactId>
</dependency>
<!-- end of apollo -->
<!-- redis -->
<!-- <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-redis</artifactId>
</dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId>
</dependency> -->
<!-- end of redis -->
<!-- eureka -->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
<exclusions>
<exclusion>
<artifactId>
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<parent>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-configservice
</artifactId>
<name>
Apollo ConfigService
</name>
<dependencies>
<!-- apollo -->
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo-biz
</artifactId>
</dependency>
<!-- end of apollo -->
<!-- redis -->
<!-- <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-redis</artifactId>
</dependency> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId>
</dependency> -->
<!-- end of redis -->
<!-- eureka -->
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-starter-eureka-server
</artifactId>
<exclusions>
<exclusion>
<artifactId>
spring-cloud-starter-archaius
</artifactId>
<groupId>
org.springframework.cloud
</groupId>
</exclusion>
<exclusion>
<artifactId>
spring-cloud-starter-ribbon
</artifactId>
<groupId>
org.springframework.cloud
</groupId>
</exclusion>
<exclusion>
<artifactId>
ribbon-eureka
</artifactId>
<groupId>
com.netflix.ribbon
</groupId>
</exclusion>
<exclusion>
<artifactId>
aws-java-sdk-core
</artifactId>
<groupId>
com.amazonaws
</groupId>
</exclusion>
<exclusion>
<artifactId>
aws-java-sdk-ec2
</artifactId>
<groupId>
com.amazonaws
</groupId>
</exclusion>
<exclusion>
<artifactId>
aws-java-sdk-autoscaling
</artifactId>
<groupId>
com.amazonaws
</groupId>
</exclusion>
<exclusion>
<artifactId>
aws-java-sdk-sts
</artifactId>
<groupId>
com.amazonaws
</groupId>
</exclusion>
<exclusion>
<artifactId>
aws-java-sdk-route53
</artifactId>
<groupId>
com.amazonaws
</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- end of eureka -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<executable>
true
</executable>
</configuration>
</plugin>
</plugins>
</build>
<groupId>
org.springframework.cloud
</groupId>
</exclusion>
<exclusion>
<artifactId>
spring-cloud-starter-ribbon
</artifactId>
<groupId>
org.springframework.cloud
</groupId>
</exclusion>
<exclusion>
<artifactId>
ribbon-eureka
</artifactId>
<groupId>
com.netflix.ribbon
</groupId>
</exclusion>
<exclusion>
<artifactId>
aws-java-sdk-core
</artifactId>
<groupId>
com.amazonaws
</groupId>
</exclusion>
<exclusion>
<artifactId>
aws-java-sdk-ec2
</artifactId>
<groupId>
com.amazonaws
</groupId>
</exclusion>
<exclusion>
<artifactId>
aws-java-sdk-autoscaling
</artifactId>
<groupId>
com.amazonaws
</groupId>
</exclusion>
<exclusion>
<artifactId>
aws-java-sdk-sts
</artifactId>
<groupId>
com.amazonaws
</groupId>
</exclusion>
<exclusion>
<artifactId>
aws-java-sdk-route53
</artifactId>
<groupId>
com.amazonaws
</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- end of eureka -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<executable>
true
</executable>
</configuration>
</plugin>
</plugins>
</build>
</project>
apollo-configservice/src/main/java/com/ctrip/apollo/configservice/controller/WebMvcConfig.java
0 → 100644
浏览文件 @
05f3a9c8
package
com.ctrip.apollo.configservice.controller
;
import
java.util.List
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.web.PageableHandlerMethodArgumentResolver
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.method.support.HandlerMethodArgumentResolver
;
import
org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
;
@Configuration
@EnableWebMvc
public
class
WebMvcConfig
extends
WebMvcConfigurerAdapter
{
@Override
public
void
addArgumentResolvers
(
List
<
HandlerMethodArgumentResolver
>
argumentResolvers
)
{
PageableHandlerMethodArgumentResolver
resolver
=
new
PageableHandlerMethodArgumentResolver
();
resolver
.
setFallbackPageable
(
new
PageRequest
(
0
,
10
));
argumentResolvers
.
add
(
resolver
);
}
@Override
public
void
configureContentNegotiation
(
ContentNegotiationConfigurer
configurer
)
{
configurer
.
ignoreAcceptHeader
(
true
).
defaultContentType
(
MediaType
.
APPLICATION_JSON
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录