切换导航条
此项目
正在载入...
登录
message_bus
/
message_bus_service
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
王勇
5 years ago
提交
fc4f2e9d60a009271c284636c09c2af89994b514
1 个父辈
b7a8ac93
将es环境放到application.yml文件中
显示空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
18 行增加
和
11 行删除
config/application.yml
src/main/java/com/sunyo/wlpt/message/bus/service/config/ElasticSearchConfig.java
src/main/java/com/sunyo/wlpt/message/bus/service/config/SwaggerConfig.java
config/application.yml
查看文件 @
fc4f2e9
...
...
@@ -102,6 +102,11 @@ management:
shutdown
:
enabled
:
true
es
:
hostname
:
192.168.37.139
port
:
9200
scheme
:
http
# 基础信息配置
info
:
version
:
1.0
...
...
src/main/java/com/sunyo/wlpt/message/bus/service/config/ElasticSearchConfig.java
查看文件 @
fc4f2e9
...
...
@@ -3,6 +3,7 @@ package com.sunyo.wlpt.message.bus.service.config;
import
org.apache.http.HttpHost
;
import
org.elasticsearch.client.RestClient
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.elasticsearch.config.AbstractElasticsearchConfiguration
;
...
...
@@ -16,23 +17,24 @@ import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
@Configuration
public
class
ElasticSearchConfig
extends
AbstractElasticsearchConfiguration
{
@Value
(
"${es.hostname}"
)
private
String
hostname
;
@Value
(
"${es.port}"
)
private
Integer
port
;
@Value
(
"${es.scheme}"
)
private
String
scheme
;
@Override
@Bean
public
RestHighLevelClient
elasticsearchClient
()
{
RestHighLevelClient
client
=
new
RestHighLevelClient
(
RestClient
.
builder
(
// 天生契合集群,有几个es环境,就 new HttpHost 几个,用,相隔
new
HttpHost
(
"192.168.37.139"
,
9200
,
"http"
)
new
HttpHost
(
hostname
,
port
,
scheme
)
)
);
return
client
;
...
...
src/main/java/com/sunyo/wlpt/message/bus/service/config/SwaggerConfig.java
查看文件 @
fc4f2e9
...
...
@@ -19,7 +19,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
public
class
SwaggerConfig
{
@Bean
public
Docket
createRestApi
()
{
public
Docket
createRestApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
select
()
...
...
@@ -27,15 +28,14 @@ public class SwaggerConfig {
.
paths
(
PathSelectors
.
any
())
.
build
();
}
/**
* 默认访问地址是:http://${host}:${port}/doc.html
*/
private
ApiInfo
apiInfo
()
{
private
ApiInfo
apiInfo
()
{
return
new
ApiInfoBuilder
()
.
title
(
"消息平台控制中心 APIs"
)
.
description
(
"swagger-bootstrap-ui"
)
.
title
(
"消息总线平台--后台管理服务"
)
.
description
(
"消息总线平台--后台管理服务"
)
.
termsOfServiceUrl
(
"http://localhost:9030/"
)
.
contact
(
"
523186180@qq.com
"
)
.
contact
(
"
子诚
"
)
.
version
(
"1.0.0"
)
.
build
();
}
...
...
请
注册
或
登录
后发表评论