全文检索工具elasticsearch:第三章: Java程序中的应用

2022-12-30 12:04:03 浏览数 (1)

搭建模块

创建二个项目

gmall-list-service的appliction.properties:

代码语言:javascript复制
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
123456789101112131415161718

gmall-list-service的pom.xml:

代码语言:javascript复制
 <?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>
                        <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
         
        </project>
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263

其中jest和jna请将版本号,部分纳入gmall-parent中管理。spring-boot-starter-data-elasticsearch不用管理版本号,其版本跟随springboot的1.5.10大版本号。

更多内容请见原文,原文转载自:https://blog.csdn.net/weixin_44519496/article/details/120482020

0 人点赞