Commit 5e29d07c authored by 张辰's avatar 张辰

es config

parent 27a98eb2
package com.tanpu.community; package com.tanpu.community;
import com.tanpu.community.config.ESConfig;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
...@@ -13,7 +14,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; ...@@ -13,7 +14,6 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableCaching @EnableCaching
@EnableScheduling @EnableScheduling
@EnableFeignClients @EnableFeignClients
@EnableConfigurationProperties
public class CommunityApplication { public class CommunityApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -10,18 +10,22 @@ import org.elasticsearch.client.RestClient; ...@@ -10,18 +10,22 @@ import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Component @Configuration
@ConfigurationProperties(prefix = "es")
public class ESConfig { public class ESConfig {
@Value("${es.userName}")
private String userName; private String userName;
@Value("${es.userPasswd}")
private String userPasswd; private String userPasswd;
@Value("${es.host}")
private String host; private String host;
@Value("${es.port}")
private Integer port; private Integer port;
@Bean @Bean
......
...@@ -108,3 +108,9 @@ aliyun: ...@@ -108,3 +108,9 @@ aliyun:
accessId: LTAIAKEzVydP0Q9P accessId: LTAIAKEzVydP0Q9P
accessSK: 59V9ke9txaIFzWxHFKTb1eoOOpmKpJ accessSK: 59V9ke9txaIFzWxHFKTb1eoOOpmKpJ
bucketName: tamp-sit bucketName: tamp-sit
es:
host: 42.194.224.208
port: 9200
userName: 1
userPasswd: 2
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment