提交 7890a56c 编写于 作者: 武汉红喜's avatar 武汉红喜

upgrade to spring boot 2.3.0

上级 dbd41335
......@@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.1.RELEASE</version>
<version>2.3.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<modelVersion>4.0.0</modelVersion>
......
......@@ -11,7 +11,6 @@ import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.validation.Valid;
import java.io.File;
/**
......@@ -24,7 +23,7 @@ public class InitializrController {
private static final String CMD = "sh generate.sh ";
@PostMapping
public ResponseEntity<byte[]> initialize(@Valid ProjectMeta projectMeta) throws Exception {
public ResponseEntity<byte[]> initialize(ProjectMeta projectMeta) throws Exception {
if (StringUtils.isEmpty(projectMeta.getPackageName())) {
projectMeta.setPackageName(projectMeta.getGroupId());
}
......
......@@ -2,19 +2,14 @@ package org.hongxi.whatsmars.initializr.model;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
/**
* Created by shenhongxi on 2020/7/2.
*/
@Data
public class ProjectMeta {
@NotEmpty
private String type;
@NotEmpty
private String groupId;
@NotEmpty
private String artifactId;
private String packageName;
private boolean includeActuator;
......
......@@ -6,12 +6,7 @@ import org.apache.http.util.EntityUtils;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.Response;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.data.elasticsearch.core.query.SearchQuery;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.*;
......@@ -28,31 +23,12 @@ public class SimpleController {
private static final String QUERY_PARAMETER_REST_TOTAL_HITS_AS_INT = "rest_total_hits_as_int";
private static final String QUERY_PARAMETER_IGNORE_THROTTLED = "ignore_throttled";
@Autowired
private ElasticsearchTemplate elasticsearchTemplate;
@Autowired
private CustomerRepository repository;
@Autowired
private RestClient restClient;
@RequestMapping("/indexExists/{indexName}")
public Boolean indexExists(@PathVariable String indexName) {
return elasticsearchTemplate.indexExists(indexName);
}
@RequestMapping("/search/{indices}")
public List<Customer> query(@PathVariable String indices) {
QueryBuilder queryBuilder= QueryBuilders.boolQuery()
.must(QueryBuilders.matchQuery("firstName", "Alice"));
SearchQuery searchQuery = new NativeSearchQueryBuilder()
.withIndices(indices)
.withQuery(queryBuilder)
.build();
return elasticsearchTemplate.queryForList(searchQuery, Customer.class);
}
@RequestMapping("/save")
public String testEsRepo() {
saveCustomers();
......
......@@ -14,7 +14,7 @@
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.11</artifactId>
<artifactId>kafka_2.12</artifactId>
<version>${kafka.version}</version>
</dependency>
<dependency>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册