升级Spring Cloud Hoxton & Alibaba,认证授权改用Oauth2。

This commit is contained in:
macro
2020-08-15 10:51:40 +08:00
parent d004888a10
commit dae82f62ed
258 changed files with 4671 additions and 3092 deletions

View File

@@ -2,14 +2,13 @@ package com.macro.mall.search;
import com.macro.mall.search.dao.EsProductDao;
import com.macro.mall.search.domain.EsProduct;
import com.macro.mall.search.repository.EsProductRepository;
import org.elasticsearch.action.search.SearchResponse;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.data.elasticsearch.core.ResultsExtractor;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.IndexOperations;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
@@ -21,7 +20,7 @@ public class MallSearchApplicationTests {
@Autowired
private EsProductDao productDao;
@Autowired
private ElasticsearchTemplate elasticsearchTemplate;
private ElasticsearchRestTemplate elasticsearchTemplate;
@Test
public void contextLoads() {
}
@@ -32,8 +31,9 @@ public class MallSearchApplicationTests {
}
@Test
public void testEsProductMapping(){
elasticsearchTemplate.putMapping(EsProduct.class);
Map mapping = elasticsearchTemplate.getMapping(EsProduct.class);
IndexOperations indexOperations = elasticsearchTemplate.indexOps(EsProduct.class);
indexOperations.putMapping(indexOperations.createMapping(EsProduct.class));
Map mapping = indexOperations.getMapping();
System.out.println(mapping);
}