1、jdk 17
2、spring boot 3.1.7
3、pom.xml
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.7</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>milvus-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>milvus-client</name>
<description>milvus-client</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>3.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>io.milvus</groupId>
<artifactId>milvus-sdk-java</artifactId>
<version>2.2.9</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.31</version>
</dependency>
<dependency>
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
<version>7.16.3</version>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-exec</artifactId>
<version>1.3</version>
</dependency>
<!-- <dependency> -->
<!-- <groupId>com.aliyun.oss</groupId> -->
<!-- <artifactId>aliyun-sdk-oss</artifactId> -->
<!-- <version>3.10.2</version> -->
<!-- <exclusions> -->
<!-- <exclusion> -->
<!-- <artifactId>httpclient</artifactId> -->
<!-- <groupId>org.apache.httpcomponents</groupId> -->
<!-- </exclusion> -->
<!-- </exclusions> -->
<!-- </dependency> -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${artifactId}-${version}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
4、resources
application.yml
spring:
profiles:
active: test
mvc:
pathmatch:
matching-strategy: ANT_PATH_MATCHER
#server:
# servlet:
# context-path: /milvus
# profiles:
# active: prod
# port: 8088
#milvus:
# host: milvusproxy1.com.cn
# port: 19530
# username: root
# password: Milvus
#
#spring:
# datasource:
## url: jdbc:mysql://rm-XXXXXXXXXX.mysql.rds.ops.cloud.com.cn:3306/milvus_kg?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
## username: milvus_kg
## password: x63#7Hbf*********SKNyB2
# url: jdbc:mysql://1.1.1.240:3306/milvus_kg?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
# username: milvus_kg
# password: m6G2^**************hc8EdwBwk5
#
#elasticsearch:
# uris: 10.246.100.**:9201,10.246.100.**:9201,10.246.100.**:9201
# port: 9201
# username: elastic
# password: milvus*******585960
#mybatis-plus:
# global-config:
# db-config:
# table-prefix: tbl_
# id-type: auto
#mybatis.mapper-locations: classpath*:mapper/*.xml
application-prod.yml
server:
servlet:
context-path: /milvus
port: 8088
milvus:
host: milvusproxy1.com.cn
port: 19530
username: root
password: Milvus
database: knowledge_brain
spring:
datasource:
url: jdbc:mysql://rm-***********.mysql.rds.ops.cloud.com.cn:3306/milvus_kg?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: milvus_kg
password: x63#7Hbf********SKNyB1
elasticsearch:
uris: 10.146.10.**:9101,10.146.10.**:9101,10.146.10.**:9101
port: 9101
username: elastic
password: Milvus&**************139140141
default_index: knowledge
oss:
endpoint: http://*********oss0c83-cn-beijing-comcloud-d01-a.ops.cloud.com.cn/
bucketName: mindmatrix-dev
localPath: /data/oss/
accessKeyId: A6gWne*************pOoa1saR
secrctAccessKey: DzSGTgiBuzEtJP************juZMqb73Ykyg4167
#mybatis-plus:
# global-config:
# db-config:
# table-prefix: tbl_
# id-type: auto
mybatis.mapper-locations: classpath*:mapper/*.xml
logging:
level:
com.com.milvusclient: error
embedding:
url: http://10.146.10.**:3000/getEmbedding?embedding_name=BAAI-bge-large-zh&
application-test.yml
server:
servlet:
context-path: /milvus
port: 8088
milvus:
host: 10.245.17.**
port: 1111
username: root
password: Milvus
database: knowledge_brain
spring:
datasource:
url: jdbc:mysql://10.246.100.**:3306/milvus_kg?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: milvus_kg
password: m6G2^************hc8EdwBwk5
elasticsearch:
uris: 10.246.100.**:9201,10.246.100.**:9201,10.246.100.**:9201
port: 9201
username: elastic
password: milvus********585960
default_index: knowledge
oss:
endpoint: http://oss0c83-cn-beijing-comcloud-d01-a.ops.cloud.com.cn/
bucketName: mindmatrix-dev
localPath: /data/oss/
accessKeyId: A6gWneM**************GpOoa2saR
secrctAccessKey: DzSGTgiBuzEtJPjuZ****************Mqb73Ykyg4267
#mybatis-plus:
# global-config:
# db-config:
# table-prefix: tbl_
# id-type: auto
mybatis.mapper-locations: classpath*:mapper/*.xml
logging:
level:
com.com.milvusclient: info
embedding:
url: http://10.246.100.**:3000/getEmbedding?embedding_name=BAAI-bge-large-zh&
5、目录结构