SpringBoot集成Solr實(shí)現(xiàn)全文檢索功能
SrpingBoot 集成 Solr 實(shí)現(xiàn)全文檢索
一、核心路線
- 使用 Docker 鏡像部署 Solr 8.11.3 版本服務(wù)
- 使用 ik 分詞器用于處理中文分詞
- 使用 spring-boot-starter-data-solr 實(shí)現(xiàn)增刪改查
- 配置用戶名密碼認(rèn)證
- 使用 poi 和 pdfbox 組件進(jìn)行文本內(nèi)容讀取
- 文章最上方有源碼和 ik 分詞器資源
二、Solr Docker 鏡像制作
由于 Solr 官方鏡像無(wú)法通過(guò)環(huán)境變量直接配置用戶名密碼認(rèn)證,所以選用第三方的 bitnami/solr
鏡像作為基礎(chǔ),將 ik 分詞器插件封裝后得到新的鏡像。
拉取 bitnami/solr
鏡像
docker pull bitnami/solr:8.11.3
下載 ik 分詞器 jar 包 ik-analyzer-8.5.0.jar
編寫 Dockerfile 文件
FROM bitnami/solr:8.11.3 COPY ./ik-analyzer-8.5.0.jar /opt/bitnami/solr/server/solr-webapp/webapp/WEB-INF/lib/ CMD ["/opt/bitnami/scripts/solr/run.sh"]
構(gòu)建鏡像
docker build -t bitnami/solr:8.11.3-ik .
三、部署 Solr 服務(wù)
方式一:普通 docker 命令行部署
創(chuàng)建數(shù)據(jù)目錄,例如 /home/solr-data
啟動(dòng)容器
docker run -d -p 8983:8983 --name solr \ -v /home/solr-data:/bitnami \ -e SOLR_ENABLE_AUTHENTICATION=yes \ -e SOLR_CORES=my_core \ -e SOLR_ADMIN_USERNAME=admin \ -e SOLR_ADMIN_PASSWORD=SolrPass \ bitnami/solr:8.11.3-ik
方式二:Rancher 云平臺(tái)部署
由于 solr 鏡像默認(rèn)使用 solr 用戶啟動(dòng)容器,掛載的 pvc 沒有寫入權(quán)限,需要按照以下步驟進(jìn)行:
以 UID=0 即 root 用戶進(jìn)行啟動(dòng),并且入口 Entrypoint 使用 /bin/bash 覆蓋默認(rèn)啟動(dòng)命令,然后進(jìn)入容器命令行
修改數(shù)據(jù)目錄屬主
chown -R solr:solr /bitnami/
去掉入口(Entrypoint)命令,用戶 UID 設(shè)置為 1000 即 solr,重啟工作負(fù)載即可
四、配置 Solr 用戶權(quán)限
訪問(wèn) http://localhost:8983
即可打開 solr 控制臺(tái),輸入賬號(hào)密碼 admin/SolrPass
登錄認(rèn)證
為了演示方便,直接給 admin 用戶賦予全部權(quán)限
五、配置 my_core 的 ik 分詞
編輯 /bitnami/solr/server/solr/my_core/conf/managed-schema
配置文件,追加以下配置內(nèi)容:
<!--ik 分詞插件配置--> <fieldType name="text_ik" class="solr.TextField"> <analyzer type="index"> <tokenizer class="org.wltea.analyzer.lucene.IKTokenizerFactory" conf="ik.conf" useSmart="false"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> <analyzer type="query"> <tokenizer class="org.wltea.analyzer.lucene.IKTokenizerFactory" conf="ik.conf" useSmart="true"/> <filter class="solr.LowerCaseFilterFactory"/> </analyzer> </fieldType>
配置完成后重啟 solr 容器。
六、創(chuàng)建 SpringBoot 工程
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>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.3.4.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.example</groupId> <artifactId>solr-example</artifactId> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--Solr--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-solr</artifactId> </dependency> <!--Solr 認(rèn)證--> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> </dependency> <!--讀取 docx 文檔內(nèi)容--> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>5.2.2</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>5.2.2</version> </dependency> <!--讀取 doc 文檔內(nèi)容--> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-scratchpad</artifactId> <version>5.2.2</version> </dependency> <!--讀取 PDF 文檔內(nèi)容--> <dependency> <groupId>org.apache.pdfbox</groupId> <artifactId>pdfbox</artifactId> <version>2.0.26</version> </dependency> <!--Hutool 工具類--> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.8.2</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> </dependencies> <build> <finalName>${project.artifactId}</finalName> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.3.3.RELEASE</version> <executions> <execution> <phase>package</phase> <goals> <goal>repackage</goal><!--可以把依賴的包都打包到生成的Jar包中--> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
配置文件
server: port: 18888 spring: servlet: # 文件上傳配置 multipart: enabled: true max-file-size: 100MB max-request-size: 100MB data: solr: host: http://localhost:8983/solr # solr 服務(wù)地址 username: admin # solr 用戶名 password: SolrPass # solr 密碼
工程啟動(dòng)類
package com.example.solr; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.data.solr.repository.config.EnableSolrRepositories; @EnableSolrRepositories // 啟用 solr repository @SpringBootApplication public class SolrExampleApplication { public static void main(String[] args) { SpringApplication.run(SolrExampleApplication.class, args); } }
SolrConfig 配置類
該類用于配置 Solr 認(rèn)證
import org.apache.http.HttpHost; import org.apache.http.HttpRequest; import org.apache.http.HttpRequestInterceptor; import org.apache.http.auth.AuthScope; import org.apache.http.auth.AuthState; import org.apache.http.auth.Credentials; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.protocol.HttpClientContext; import org.apache.http.impl.auth.BasicScheme; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.protocol.HttpContext; import org.apache.http.protocol.HttpCoreContext; import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.net.URI; @Configuration public class SolrConfig { @Value("${spring.data.solr.username}") private String username; @Value("${spring.data.solr.password}") private String password; @Value("${spring.data.solr.host}") private String uri; /*** * 配置 solr 賬號(hào)密碼 */ @Bean public HttpSolrClient solrClient() { CredentialsProvider provider = new BasicCredentialsProvider(); final URI uri = URI.create(this.uri); provider.setCredentials(new AuthScope(uri.getHost(), uri.getPort()), new UsernamePasswordCredentials(this.username, this.password)); HttpClientBuilder builder = HttpClientBuilder.create(); // 指定攔截器,用于設(shè)置認(rèn)證信息 builder.addInterceptorFirst(new SolrAuthInterceptor()); builder.setDefaultCredentialsProvider(provider); CloseableHttpClient httpClient = builder.build(); return new HttpSolrClient.Builder(this.uri).withHttpClient(httpClient).build(); } public static class SolrAuthInterceptor implements HttpRequestInterceptor { @Override public void process(final HttpRequest request, final HttpContext context) { AuthState authState = (AuthState) context.getAttribute(HttpClientContext.TARGET_AUTH_STATE); if (authState.getAuthScheme() == null) { CredentialsProvider provider = (CredentialsProvider) context.getAttribute(HttpClientContext.CREDS_PROVIDER); HttpHost httpHost = (HttpHost) context.getAttribute(HttpCoreContext.HTTP_TARGET_HOST); AuthScope scope = new AuthScope(httpHost.getHostName(), httpHost.getPort()); Credentials credentials = provider.getCredentials(scope); authState.update(new BasicScheme(), credentials); } } } }
MyDocument 實(shí)體類
import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.apache.solr.client.solrj.beans.Field; import org.springframework.data.annotation.Id; import org.springframework.data.solr.core.mapping.Indexed; import org.springframework.data.solr.core.mapping.SolrDocument; import java.io.Serializable; @Data @NoArgsConstructor @AllArgsConstructor @SolrDocument(collection = "my_core") // 此處配置 core 信息 public class MyDocument implements Serializable { @Id @Field private String id; // 使用 string 類型即不進(jìn)行分詞 @Indexed(name = "type", type = "string") private String type; // 使用 text_ik 類型即使用 ik 分詞器進(jìn)行分詞索引和查詢 @Indexed(name = "title", type = "text_ik") private String title; // 使用 text_ik 類型即使用 ik 分詞器進(jìn)行分詞索引和查詢 @Indexed(name = "content", type = "text_ik") private String content; }
MyDocumentRepository 類
該類用于和 solr 服務(wù)進(jìn)行通信,實(shí)現(xiàn)增刪改查操作。
import com.example.solr.entity.MyDocument; import org.springframework.data.domain.Pageable; import org.springframework.data.solr.core.query.result.HighlightPage; import org.springframework.data.solr.repository.Highlight; import org.springframework.data.solr.repository.Query; import org.springframework.data.solr.repository.SolrCrudRepository; import java.util.List; public interface MyDocumentRepository extends SolrCrudRepository<MyDocument, String> { /** * 按類型進(jìn)行查詢 * * @param type 類型 * @return 查詢結(jié)果 */ @Query("type:?0") List<MyDocument> findAllByType(String type); /** * 按照標(biāo)題或內(nèi)容進(jìn)行模糊查詢,并且對(duì)關(guān)鍵詞進(jìn)行高亮標(biāo)記 * snipplets = 3 用于指定查詢出符合條件的結(jié)果數(shù),不指定則只能查出一條 * * @param title 標(biāo)題關(guān)鍵詞 * @param content 內(nèi)容關(guān)鍵詞 * @param pageable 分頁(yè)對(duì)象 * @return 帶有高亮標(biāo)記的查詢結(jié)果 */ @Highlight(snipplets = 3, fields = {"title", "content"}, prefix = "<span style='color:red'>", postfix = "</span>") HighlightPage<MyDocument> findAllByTitleOrContent(String title, String content, Pageable pageable); }
MyDocumentService 類
import com.example.solr.entity.MyDocument; import org.springframework.data.domain.Pageable; import java.util.List; import java.util.Map; public interface MyDocumentService { MyDocument save(MyDocument document); void saveAll(List<MyDocument> documentList); void delete(String id); MyDocument findById(String id); List<MyDocument> findAllByType(String type); List<Map<String, Object>> findAllByTitleOrContent(String searchItem, Pageable pageable); }
對(duì)應(yīng)的實(shí)現(xiàn)類
import com.example.solr.entity.MyDocument; import com.example.solr.repository.MyDocumentRepository; import com.example.solr.service.MyDocumentService; import org.springframework.data.domain.Pageable; import org.springframework.data.solr.core.query.result.HighlightEntry; import org.springframework.data.solr.core.query.result.HighlightPage; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Service public class MyDocumentServiceImpl implements MyDocumentService { @Resource private MyDocumentRepository repository; @Override public MyDocument save(MyDocument document) { return repository.save(document); } @Override public void saveAll(List<MyDocument> documentList) { repository.saveAll(documentList); } @Override public void delete(String id) { repository.delete(findById(id)); } @Override public MyDocument findById(String id) { return repository.findById(id).orElse(null); } @Override public List<MyDocument> findAllByType(String type) { return repository.findAllByType(type); } @Override public List<Map<String, Object>> findAllByTitleOrContent(String searchItem, Pageable pageable) { // 查詢分頁(yè)結(jié)果 HighlightPage<MyDocument> page = repository.findAllByTitleOrContent(searchItem, searchItem, pageable); List<Map<String, Object>> result = new ArrayList<>(); // 處理查詢結(jié)果高亮片段 for (HighlightEntry<MyDocument> highlight : page.getHighlighted()) { // 每個(gè) map 對(duì)應(yīng)一個(gè)文檔 Map<String, Object> map = new HashMap<>(); MyDocument doc = highlight.getEntity(); map.put("id", doc.getId()); map.put("type", doc.getType()); map.put("title", doc.getTitle()); for (HighlightEntry.Highlight hl : highlight.getHighlights()) { map.put(hl.getField().getName(), hl.getSnipplets()); } result.add(map); } return result; } }
FileUtil 文件內(nèi)容處理類
import cn.hutool.core.util.StrUtil; import lombok.extern.slf4j.Slf4j; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.text.PDFTextStripper; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.extractor.WordExtractor; import org.apache.poi.xwpf.usermodel.XWPFDocument; import org.apache.poi.xwpf.usermodel.XWPFParagraph; import org.apache.poi.xwpf.usermodel.XWPFRun; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; import java.io.InputStream; @Slf4j public class FileUtil { /** * 讀取文檔內(nèi)容 * 目前僅支持 txt, doc, docx, pdf 格式 * * @param file 文件對(duì)象 * @return 文檔內(nèi)容 */ public static String readFileContent(MultipartFile file) { String filename = file.getOriginalFilename(); assert filename != null; String fileType = filename.substring(filename.lastIndexOf(".") + 1).toUpperCase(); switch (fileType) { case "TXT": return readTxtContent(file); case "DOC": case "DOCX": return readWordContent(file); case "PDF": return readPDFContent(file); default: return ""; } } /** * 讀取 txt 文檔內(nèi)容 */ private static String readTxtContent(MultipartFile file) { try { return StrUtil.utf8Str(file.getBytes()); } catch (IOException e) { e.printStackTrace(); log.error("讀取 txt 文件內(nèi)容時(shí)發(fā)生 IO 異常"); return ""; } } /** * 讀取 doc 和 docx 文檔內(nèi)容 */ private static String readWordContent(MultipartFile file) { String filename = file.getOriginalFilename(); assert filename != null; String fileType = filename.substring(filename.lastIndexOf(".") + 1); return "doc".equals(fileType) ? readDocContent(file) : readDocxContent(file); } /** * 讀取 .doc 格式的 word 文檔 * * @param file 文件對(duì)象 * @return 文本內(nèi)容 */ private static String readDocContent(MultipartFile file) { StringBuilder content = new StringBuilder(); try (InputStream inputStream = file.getInputStream(); HWPFDocument document = new HWPFDocument(inputStream)) { WordExtractor extractor = new WordExtractor(document); String[] paragraphs = extractor.getParagraphText(); for (String paragraph : paragraphs) { content.append(paragraph); } } catch (IOException e) { e.printStackTrace(); log.error("讀取文件內(nèi)容時(shí)發(fā)生 IO 異常"); } return content.toString(); } /** * 讀取 .docx 格式的 word 文檔 * * @param file 文件對(duì)象 * @return 文本內(nèi)容 */ private static String readDocxContent(MultipartFile file) { StringBuilder content = new StringBuilder(); try (InputStream inputStream = file.getInputStream(); XWPFDocument document = new XWPFDocument(inputStream)) { for (XWPFParagraph paragraph : document.getParagraphs()) { for (XWPFRun run : paragraph.getRuns()) { String runText = run.getText(0); if (runText != null) { content.append(runText); } } } } catch (IOException e) { e.printStackTrace(); log.error("讀取文件內(nèi)容時(shí)發(fā)生 IO 異常"); } return content.toString(); } /** * 讀取 pdf 文檔內(nèi)容 */ private static String readPDFContent(MultipartFile file) { StringBuilder content = new StringBuilder(); try (InputStream inputStream = file.getInputStream(); PDDocument document = PDDocument.load(inputStream)) { // 檢查是否是由文檔轉(zhuǎn)換出的 pdf 文件 if (!document.isEncrypted() && document.getNumberOfPages() > 0) { PDFTextStripper textStripper = new PDFTextStripper(); content.append(textStripper.getText(document)); } else { log.warn("PDF 已加密或不是由文檔轉(zhuǎn)換的 PDF 格式,無(wú)法讀取內(nèi)容!"); } } catch (IOException e) { e.printStackTrace(); log.error("讀取文件內(nèi)容時(shí)發(fā)生 IO 異常"); } return content.toString(); } }
MyDocumentController 控制器類
package com.example.solr.controller; import com.example.solr.entity.MyDocument; import com.example.solr.service.MyDocumentService; import com.example.solr.util.FileUtil; import org.springframework.data.domain.PageRequest; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; @RestController @RequestMapping("/solr") public class MyDocumentController { @Resource private MyDocumentService documentService; /** * 上傳文檔文件,讀取文檔內(nèi)容并寫入 solr * * @param file 上傳的文檔文件,僅支持讀取以下格式的文件內(nèi)容 txt, doc, docx, pdf(由文檔轉(zhuǎn)換生成的) * @param type 文件分類 * @return 處理結(jié)果 */ @PostMapping("/upload") public Map<String, Object> upload(@RequestPart("multipartFile") MultipartFile file, @RequestParam String type) { MyDocument doc = new MyDocument(); doc.setId(UUID.randomUUID().toString()); doc.setType(type); doc.setTitle(file.getOriginalFilename()); doc.setContent(FileUtil.readFileContent(file)); documentService.save(doc); Map<String, Object> result = new HashMap<>(); result.put("result", true); result.put("data", doc); return result; } /** * 直接向 solr 添加內(nèi)容 * * @param type 類型 * @param title 標(biāo)題 * @param content 內(nèi)容 * @return 處理結(jié)果 */ @PostMapping("/save") public Map<String, Object> save(@RequestParam String type, @RequestParam String title, @RequestParam String content) { MyDocument doc = new MyDocument(); doc.setId(UUID.randomUUID().toString()); doc.setType(type); doc.setTitle(title); doc.setContent(content); documentService.save(doc); Map<String, Object> result = new HashMap<>(); result.put("result", true); result.put("data", doc); return result; } /** * 刪除 solr 內(nèi)容 * * @param id 主鍵 * @return 處理結(jié)果 */ @DeleteMapping("/delete") public Map<String, Object> delete(@RequestParam String id) { documentService.delete(id); Map<String, Object> result = new HashMap<>(); result.put("result", true); result.put("data", null); return result; } /** * 根據(jù)標(biāo)題或內(nèi)容模糊搜索,并且高亮關(guān)鍵詞 * * @param searchItem 搜索關(guān)鍵詞 * @param page 頁(yè)碼 * @param size 每頁(yè)數(shù)量 * @return 查詢結(jié)果 */ @GetMapping("/searchTitleOrContent") public Map<String, Object> searchTitleOrContent(@RequestParam String searchItem, @RequestParam Integer page, @RequestParam Integer size) { List<Map<String, Object>> data = documentService.findAllByTitleOrContent(searchItem, PageRequest.of(page, size)); Map<String, Object> result = new HashMap<>(); result.put("result", true); result.put("data", data); return result; } /** * 根據(jù)類型搜索 * * @param type 類型 * @return 查詢結(jié)果 */ @GetMapping("/searchType") public Map<String, Object> searchType(@RequestParam String type) { List<MyDocument> data = documentService.findAllByType(type); Map<String, Object> result = new HashMap<>(); result.put("result", true); result.put("data", data); return result; } }
七、驗(yàn)證
啟動(dòng)服務(wù),使用 postman 等工具進(jìn)行接口請(qǐng)求。
1. 直接寫入 solr 內(nèi)容
2. 上傳 word 文檔讀取內(nèi)容寫入 solr
3. 根據(jù)類型精確查詢
4. 根據(jù)標(biāo)題或內(nèi)容模糊查詢
以上就是SpringBoot集成Solr實(shí)現(xiàn)全文檢索功能的詳細(xì)內(nèi)容,更多關(guān)于SpringBoot Solr文檔檢索的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
springboot application.yml使用@@pom文件配置問(wèn)題
這篇文章主要介紹了springboot application.yml使用@@pom文件配置問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-07-07application.yml文件中如何開啟mybatis自動(dòng)駝峰映射
這篇文章主要介紹了application.yml文件中開啟mybatis自動(dòng)駝峰映射的方法,本文通過(guò)示例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2023-08-08Spring?AOP?后置通知修改響應(yīng)httpstatus方式
這篇文章主要介紹了Spring?AOP?后置通知修改響應(yīng)httpstatus方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-12-12Socket結(jié)合線程池使用實(shí)現(xiàn)客戶端和服務(wù)端通信demo
這篇文章主要為大家介紹了Socket結(jié)合線程池的使用來(lái)實(shí)現(xiàn)客戶端和服務(wù)端通信實(shí)戰(zhàn)demo,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步2022-03-03Spring Boot 集成 Quartz 使用Cron 表達(dá)式實(shí)現(xiàn)定
本文介紹了如何在SpringBoot項(xiàng)目中集成Quartz并使用Cron表達(dá)式進(jìn)行任務(wù)調(diào)度,通過(guò)添加Quartz依賴、創(chuàng)建Quartz任務(wù)、配置任務(wù)調(diào)度以及啟動(dòng)項(xiàng)目,可以實(shí)現(xiàn)定時(shí)任務(wù)的執(zhí)行,Cron表達(dá)式提供了靈活的任務(wù)調(diào)度方式,適用于各種復(fù)雜的定時(shí)任務(wù)需求,感興趣的朋友一起看看吧2025-03-03java基本教程之常用的實(shí)現(xiàn)多線程的兩種方式 java多線程教程
下面開始學(xué)習(xí)“常用的實(shí)現(xiàn)多線程的2種方式”:Thread 和 Runnable。之所以說(shuō)是常用的,是因?yàn)橥ㄟ^(guò)還可以通過(guò)java.util.concurrent包中的線程池來(lái)實(shí)現(xiàn)多線程2014-01-01Java程序運(yùn)行時(shí)出現(xiàn)亂碼問(wèn)題的排查與解決方法
本文主要介紹了Java程序運(yùn)行時(shí)出現(xiàn)亂碼問(wèn)題的排查與解決方法,包括檢查Java源文件編碼、檢查編譯時(shí)的編碼設(shè)置、檢查運(yùn)行時(shí)的編碼設(shè)置、檢查命令提示符的代碼頁(yè)、檢查命令提示符的字體、檢查 Java 程序的輸出代碼以及檢查環(huán)境變量,需要的朋友可以參考下2025-03-03JPA @Basic單表查詢?nèi)绾螌?shí)現(xiàn)大字段懶加載
這篇文章主要介紹了JPA @Basic單表查詢?nèi)绾螌?shí)現(xiàn)大字段懶加載的操作,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2021-08-08