说明
一般的 Web 应用都会使用到 Redis 做缓存处理,也可能会用 ElasticSearch 做全文检索。所以这里主要介绍对这个两个数据中间件的使用。Monogo方面也有对应的插件,可以自行尝试。
创建模块
在 IDEA 中通过 File->New->Modules...
可以创建新的模块 demo-nosql,基础代码和配置可以从demo01中拷贝过来,或者自己手动创建。
修改依赖
plugins {
id 'java'
id "io.freefair.lombok"
}
group = "com.example"
// 统一版本号
version "${demoVersion}"
description = "orm demo"
dependencies {
implementation platform(project(":demo-parent"))
implementation("org.noear:solon-web")
implementation("org.noear:solon-logging-logback")
implementation("org.noear:solon-openapi2-knife4j")
implementation("org.noear:solon-cache-jedis")
implementation("org.noear:esearchx")
annotationProcessor("org.mapstruct:mapstruct-processor:${mapstructVersion}")
testImplementation("org.noear:solon-test-junit5")
}
compileJava {
options.encoding = "UTF-8"
options.compi