全文检索工具elasticsearch:第三章: Java程序中的应用
搭建模块
创建二个项目
gmall-list-service的appliction.properties:
server.port=8073
spring.datasource.url=jdbc:mysql://localhost:3306/gmall?characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=root
mybatis.configuration.map-underscore-to-camel-case=true
mybatis.mapper-locations=classpath:mapper/*Mapper.xml
spring.dubbo.registry.protocol=zookeeper
spring.dubbo.registry.address=192.168.0.100:2181
spring.dubbo.application.name=gmall-list-service
spring.dubbo.protocol.name=dubbo
spring.dubbo.base-package=com.javawxid
spring.elasticsearch.jest.uris=http://192.168.0.100:9200
logging.level.root=info
gmall-list-service的pom.xml:
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.javawxid.gmall</groupId>
<artifactId>gmall-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<groupId>com.javawxid.gmall</groupId>
<artifactId>gmall-list-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>gmall-list-service</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>com.javawxid.gmall</groupId>
<artifactId>gmall-service-util</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.javawxid.gmall</groupId>
<artifactId>gmall-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<!-- 导入Jest依赖 -->
<!-- https://mvnrepository.com/artifact/io.searchbox/jest -->
<dependency>
<groupId>io.searchbox</groupId>
<artifactId>jest</artifactId>
<version>5.3.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna -->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.5.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>