利用openoffice+jodconverter-code-3.0-bate4實(shí)現(xiàn)ppt轉(zhuǎn)圖片
本文實(shí)例為大家分享了openoffice+jodconverter-code-3.0-bate4實(shí)現(xiàn)ppt轉(zhuǎn)圖片的具體代碼,供大家參考,具體內(nèi)容如下
安裝openoffice4 (用于把文檔(ppt)轉(zhuǎn)成pdf)根據(jù)系統(tǒng)的位數(shù)安裝
使用jodconverter-core3.0-beta-4(要上傳maven本地倉(cāng)庫(kù))
安裝ImageMagick:yum install ImageMagick(用于pdf轉(zhuǎn)圖片)
安裝pdftotext 用于提取文字大綱 yum install poppler-utils
perl腳本(用于提取pdf文檔的文字大綱)
使用jodconverter調(diào)用OpenOffice 將office文檔轉(zhuǎn)換為PDF時(shí)。如果轉(zhuǎn)換程序異常中止而OpenOffice并沒(méi)有停止運(yùn)行的話。
openoffice
1、啟動(dòng)tomcat時(shí),啟動(dòng)openoffice服務(wù)(個(gè)人感覺(jué)有風(fēng)險(xiǎn)問(wèn)題)
2、手工用命令,啟動(dòng)openoffice服務(wù),在使用鏈接服務(wù)(推薦)
package com.document.servers.impl; import java.io.File; import java.net.ConnectException; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import org.artofsolving.jodconverter.OfficeDocumentConverter; import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration; import org.artofsolving.jodconverter.office.ExternalOfficeManagerConfiguration; import org.artofsolving.jodconverter.office.OfficeConnectionProtocol; import org.artofsolving.jodconverter.office.OfficeManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; //import com.artofsolving.jodconverter.DefaultDocumentFormatRegistry; //import com.artofsolving.jodconverter.DocumentConverter; //import com.artofsolving.jodconverter.DocumentFamily; //import com.artofsolving.jodconverter.DocumentFormat; //import com.artofsolving.jodconverter.openoffice.connection.OpenOfficeConnection; //import com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection; //import com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter; import com.document.servers.OfficeService; /** * linux下: * cd /opt/openoffice4/program * ./soffice "-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager" -nologo -headless -nofirststartwizard & */ @Service("officeService") public class OfficeServiceImpl implements OfficeService { private static final Logger logger = LoggerFactory.getLogger(OfficeServiceImpl.class); private OfficeManager officeManager; private OfficeDocumentConverter documentConverter; // @PostConstruct // public void init() throws Exception { // // TODO Auto-generated method stub // officeManager = new DefaultOfficeManagerConfiguration().setOfficeHome("/opt/openoffice4").buildOfficeManager(); // // documentConverter = new OfficeDocumentConverter(officeManager); // // officeManager.stop(); // // logger.warn("openoffice starting...."); // try { // officeManager.start(); // logger.warn("openoffice started"); // } catch (Exception e) { // logger.error("office start failed:{}", e); // } // } // // @PreDestroy // public void destroy() throws Exception { // // TODO Auto-generated method stub // logger.info("shutdown office service...."); // if (officeManager != null) { // try { // // officeManager.stop(); // logger.info("office closed"); // } catch (Exception e) { // logger.error("office close failed:{}", e); // } // } // } // public void convert(String inputfilename, String outputfilename) { // logger.info("convert...." + inputfilename + " to " + outputfilename); // documentConverter.convert(new File(inputfilename), new File(outputfilename)); // } public void manualConvert(String inputfilename, String outputfilename) { logger.info("convert...." + inputfilename + " to " + outputfilename); // connect to an OpenOffice.org instance running on port 8100 ExternalOfficeManagerConfiguration externalProcessOfficeManager = new ExternalOfficeManagerConfiguration(); externalProcessOfficeManager.setConnectOnStart(true); externalProcessOfficeManager.setPortNumber(8100); officeManager = externalProcessOfficeManager.buildOfficeManager(); officeManager.start(); logger.info("openoffice服務(wù)已鏈接"); documentConverter = new OfficeDocumentConverter(officeManager); documentConverter.convert(new File(inputfilename), new File(outputfilename)); } }
轉(zhuǎn)換處理方法
package com.document.servers.impl; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.StringWriter; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.apache.pdfbox.pdmodel.PDDocument; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.document.defined.model.ImagePPT; import com.document.servers.OfficeService; import com.document.servers.PPTConvertServers; import com.document.tool.ImageMagickUtils; import com.document.tool.SystemConfig; import com.fasterxml.jackson.databind.ObjectMapper; import com.ppt.util.Command; @Service("pPTConvertServers") public class PPTConvertServersImpl implements PPTConvertServers { private static final Logger logger = LoggerFactory.getLogger(PPTConvertServersImpl.class); @Autowired private OfficeService officeService; /** * (non-Javadoc) * 利用openoffice把ppt轉(zhuǎn)圖片 */ public Map<String, Object> deal_ppt(HttpServletRequest request, String filePath, String extension, String title, String filename) throws Exception { logger.info("ppt轉(zhuǎn)pdf,{}"); // ppt文件地址 String ppt_target_file = filePath; // pdf文件地址 String path = filePath.substring(0, filePath.lastIndexOf(".")); String pdf_target_file = path + ".pdf"; // 輸出jpg文件地址 String images_target_file = path + "/jpg" + "-%d.jpg"; // if(exists(pdf_target_file)){ // unlink(pdf_target_file);//刪除 // } // copy(new File(ppt_target_file), ppt_target_file, true); if (!extension.equals(".pdf")) { officeService.manualConvert(ppt_target_file, pdf_target_file);// 轉(zhuǎn)成pdf文件 } StringWriter writer = new StringWriter(); // 提取文字大綱 String[] pdf_lines = extractOutLineFromPDF(pdf_target_file); File filepath = new File(images_target_file); File parentFile = filepath.getParentFile(); if (!parentFile.exists()) { logger.info("創(chuàng)建圖片目錄"); parentFile.mkdirs(); } Command.run("convert " + pdf_target_file + " " + images_target_file, writer);// 轉(zhuǎn)成圖片 String basePath = request.getScheme() + "://" + request.getServerName() + "/"; PDDocument document = PDDocument.load(new File(pdf_target_file)); int pageCount = document.getNumberOfPages(); document.close(); List<ImagePPT> list = new ArrayList<ImagePPT>(); String pathUrl = filename.substring(0, filename.lastIndexOf(".")); if (pageCount > 0) { for (int i = 0; i < pageCount; i++) { ImagePPT imagePPT = new ImagePPT(); imagePPT.setId(i + 1); if (pdf_lines.length > 0) { try { imagePPT.setTitle(pdf_lines[i]); } catch (Exception e) { // TODO Auto-generated catch block imagePPT.setTitle(title); logger.info("title,數(shù)組越界"); //e.printStackTrace(); } } else { imagePPT.setTitle(title); } imagePPT.setUrl(basePath + "images/" + pathUrl + "/jpg-" + i + ".jpg"); imagePPT.setPreviewUrl(basePath + "preview/images/" + pathUrl + "/preview/pjpg-" + i + ".jpg"); // String oimgDir = SystemConfig.getBlobDirectory() + pathUrl + "/jpg-" + i + ".jpg"; // String pimgDir = SystemConfig.getBlobDirectory() + pathUrl + "/preview/pjpg-" + i + ".jpg"; // File pfilepath = new File(pimgDir); // File pf = pfilepath.getParentFile(); // if (!pf.exists()) { // pf.mkdirs(); // } //ImageMagickUtils.scale(oimgDir, pimgDir, 240, 180);//預(yù)覽圖 list.add(imagePPT); } } // 拼接json字符串 ObjectMapper objectMapper = new ObjectMapper(); String jsonlist = objectMapper.writeValueAsString(list); // logger.info(jsonlist); Map<String, Object> map=new HashMap<String, Object>(); map.put("json", jsonlist.toString()); map.put("totalPage", pageCount); return map; } /** * 文件已經(jīng)上傳過(guò) ,進(jìn)行替換性轉(zhuǎn)換 */ public Map<String, Object> replace_ppt(HttpServletRequest request, String filePath, String extension, String title, String filename) throws Exception { logger.info("替換,ppt轉(zhuǎn)pdf,{}"); // ppt文件地址 String ppt_target_file = filePath; // pdf文件地址 String path = filePath.substring(0, filePath.lastIndexOf(".")); String pdf_target_file = path + ".pdf"; // 輸出jpg文件地址 String images_target_file = path + "/jpg" + "-%d.jpg"; if (!extension.equals(".pdf")) { officeService.manualConvert(ppt_target_file, pdf_target_file);// 轉(zhuǎn)成pdf文件 } StringWriter writer = new StringWriter(); // 提取文字大綱 String[] pdf_lines = extractOutLineFromPDF(pdf_target_file); File filepath = new File(images_target_file); File parentFile = filepath.getParentFile(); if (!parentFile.exists()) { logger.info("替換創(chuàng)建圖片目錄"); parentFile.mkdirs(); } Command.run("convert " + pdf_target_file + " " + images_target_file, writer);// 轉(zhuǎn)成圖片 String basePath = request.getScheme() + "://" + request.getServerName() + "/"; PDDocument document = PDDocument.load(new File(pdf_target_file)); int pageCount = document.getNumberOfPages(); document.close(); List<ImagePPT> list = new ArrayList<ImagePPT>(); String pathUrl = filename.substring(0, filename.lastIndexOf(".")); if (pageCount > 0) { for (int i = 0; i < pageCount; i++) { ImagePPT imagePPT = new ImagePPT(); imagePPT.setId(i + 1); if (pdf_lines.length > 0) { try { imagePPT.setTitle(pdf_lines[i]); } catch (Exception e) { // TODO Auto-generated catch block imagePPT.setTitle(title); logger.info("title,數(shù)組越界"); // e.printStackTrace(); } } else { imagePPT.setTitle(title); } imagePPT.setUrl(basePath + "images/" + pathUrl + "/jpg-" + i + ".jpg"); imagePPT.setPreviewUrl(basePath + "preview/images/" + pathUrl + "/preview/pjpg-" + i + ".jpg"); // String oimgDir = SystemConfig.getBlobDirectory() + pathUrl + "/jpg-" + i + ".jpg"; // String pimgDir = SystemConfig.getBlobDirectory() + pathUrl + "/preview/pjpg-" + i + ".jpg"; // File pfilepath = new File(pimgDir); // File pf = pfilepath.getParentFile(); // if (!pf.exists()) { // pf.mkdirs(); // } // ImageMagickUtils.scale(oimgDir, pimgDir, 240, 180); list.add(imagePPT); } } // 拼接json字符串 ObjectMapper objectMapper = new ObjectMapper(); String jsonlist = objectMapper.writeValueAsString(list); // logger.info(jsonlist); Map<String, Object> map=new HashMap<String, Object>(); map.put("json", jsonlist.toString()); map.put("totalPage", pageCount); return map; } /** * 提取pdf文字大綱 * @param pdf_file * @return * @throws UnsupportedEncodingException * @throws Exception */ public static String[] extractOutLineFromPDF(String pdf_file) throws UnsupportedEncodingException { String svndir = PPTConvertServersImpl.class.getResource("").getPath(); svndir = svndir.split("WEB-INF")[0]; svndir = svndir.replaceFirst("file:", ""); logger.info(svndir); String command = "/usr/bin/perl " + svndir + "WEB-INF/sh/pdf_outline.pl " + pdf_file; logger.info(command); ByteArrayOutputStream writer = new ByteArrayOutputStream(); Command.run2(command, writer); String outline = writer.toString("utf-8"); logger.info("title pdf,{}", outline); String[] items = outline.split("http:///"); return items; } /** * 文件是否存在 * * @param filename * @return @throws IOException */ public static boolean exists(String filename) { try { File file = new File(filename); return file.exists(); } catch (Exception e) { return false; } } /** * 刪除文件 * * @param filename * @return */ public static boolean unlink(String filename) { try { File file = new File(filename); if (file.isFile()) { file.delete(); return true; } return false; } catch (Exception e) { return false; } } /** * 拷貝文件 * * @param file * @param newname * @param overwrite * @return */ public static boolean copy(File file, String newname, boolean overwrite) { try { if (!overwrite && new File(newname).exists()) { return false; } FileInputStream input = new FileInputStream(file); File dest = new File(newname); if (!mkdir(dest.getParent())) { return false; } FileOutputStream output = new FileOutputStream(newname); byte[] b = new byte[1024 * 5]; int len; while ((len = input.read(b)) != -1) { output.write(b, 0, len); } output.flush(); output.close(); input.close(); return true; } catch (Exception e) { e.printStackTrace(); return false; } } /** * 創(chuàng)建目錄 * * @param dirname * @return */ public static boolean mkdir(String dir) { try { File file = new File(dir); if (!file.exists()) { file.mkdirs(); } return true; } catch (Exception e) { e.printStackTrace(); return false; } } }
上傳ppt文件處理類:
package com.document.handle.controller; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.util.Date; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import com.document.servers.PPTConvertServers; import com.document.tool.FilenameUtils; import com.document.tool.SystemConfig; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; @Controller public class PptToImageController { private static final Logger logger = LoggerFactory.getLogger(PptToImageController.class); private static final String TYPE_BLOB = "BLOB"; private static final String CALLBACK = "callback"; // 回調(diào)函數(shù)的參數(shù)名 @Autowired private PPTConvertServers pPTConvertServers; @RequestMapping(value = "/convert/upload") public ModelAndView updateFile(HttpServletRequest request, HttpServletResponse response) { ModelAndView mav = new ModelAndView(); mav.addObject("name", "Hello Word"); mav.setViewName("/ppt/uploadFile"); logger.info("/convert/upload"); return mav; } /** * 顯示上傳文件的頁(yè)面表單。 */ @SuppressWarnings("unchecked") private ModelAndView showUploadForm(HttpServletRequest request, String type) { // 所有請(qǐng)求參數(shù) Map<String, String> params = new HashMap<String, String>(); Enumeration<String> paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { String name = paramNames.nextElement(); String value = request.getParameter(name); if (null != value) { params.put(name, value); } } ModelAndView mav = new ModelAndView(); mav.setViewName("/upload/" + type.toLowerCase()); mav.addObject("parameters", params); return mav; } /** * 保存用戶上傳的文件。 * @throws UnsupportedEncodingException */ private Map<String, Object> saveUploadedFile(HttpServletRequest request, MultipartFile file, String type) { // 文件內(nèi)容MD5串,避免文件重復(fù)上傳 String md5 = null; try { md5 = DigestUtils.md5Hex(file.getBytes()); logger.info("文件內(nèi)容MD5串,{}", md5); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } String originalFilename = file.getOriginalFilename(); String extension = FilenameUtils.getExtension(originalFilename); // 文件擴(kuò)展名 String filename = null; if (md5 != null) { filename = FilenameUtils.generateFileNameMd5(extension, md5); } else { filename = FilenameUtils.generateFileName(extension); } String filenameUrl = null; // 文件訪問(wèn)的URL String absoluteFilename = null; // 文件存儲(chǔ)的絕對(duì)路徑 filenameUrl = SystemConfig.getBlobUrl() + filename; absoluteFilename = SystemConfig.getBlobDirectory() + filename; // 檢查是否需要?jiǎng)?chuàng)建目錄 File filepath = new File(absoluteFilename); File parentFile = filepath.getParentFile(); if (!parentFile.exists()) { parentFile.mkdirs(); } Map<String, Object> params = new HashMap<String, Object>(); // 所有請(qǐng)求參數(shù) Enumeration<String> paramNames = request.getParameterNames(); while (paramNames.hasMoreElements()) { String name = paramNames.nextElement(); String value = request.getParameter(name); if (null != value) { params.put(name, value); } } String pdftitle = originalFilename.substring(0, originalFilename.lastIndexOf(".")); params.put("title", pdftitle); Map<String, Object> officeMap=new HashMap<String, Object>(); if (filepath.exists()) { // 文件已上傳過(guò),文件進(jìn)行替換 try { officeMap = pPTConvertServers.replace_ppt(request, absoluteFilename, extension, pdftitle, filename); params.put("totalPage", officeMap.get("totalPage")); params.put("data", officeMap.get("json")); params.put("status", "success"); } catch (Exception e) { // TODO Auto-generated catch block logger.info("把ppt文件轉(zhuǎn)pdf失敗,{}", e); params.put("status", "fail"); params.put("data", "把ppt文件轉(zhuǎn)pdf失敗"); params.put("totalPage", 0); e.printStackTrace(); } return params; } // 保存文件 BufferedOutputStream bos = null; try { byte[] fileBytes = file.getBytes(); bos = new BufferedOutputStream(new FileOutputStream(filepath)); bos.write(fileBytes); } catch (IOException e) { logger.error("保存'" + originalFilename + "'時(shí)發(fā)生異常,Cause: ", e); } finally { if (null != bos) { try { bos.close(); } catch (IOException e) { } } } // params.put("url", filenameUrl); // params.put("originalFilename", originalFilename); // params.put("filesize", file.getSize()); // 把ppt文件轉(zhuǎn)pdf,pdf轉(zhuǎn)圖片 try { officeMap = pPTConvertServers.deal_ppt(request, absoluteFilename, extension, pdftitle, filename); params.put("totalPage", officeMap.get("totalPage")); params.put("data", officeMap.get("json")); params.put("status", "success"); } catch (Exception e) { // TODO Auto-generated catch block logger.info("把ppt文件轉(zhuǎn)pdf失敗,{}", e); params.put("status", "fail"); params.put("data", "把ppt文件轉(zhuǎn)pdf失敗"); params.put("totalPage", 0); e.printStackTrace(); } return params; } /** * 處理文件上傳。 * @throws IOException * */ @RequestMapping(value = "/convert/upload", method = RequestMethod.POST,produces = "text/html;charset=UTF-8") public @ResponseBody String uploadFilePost(HttpServletRequest request, @RequestParam("file") MultipartFile file) throws IOException { String callback = request.getParameter(CALLBACK); // 回調(diào)函數(shù)的函數(shù)名 String json = "請(qǐng)上傳文件"; Map<String, Object> params = new HashMap<String, Object>(); ObjectMapper mapper = new ObjectMapper(); mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); ObjectWriter writer = mapper.writerWithType(Map.class); if (!file.isEmpty()) { params = saveUploadedFile(request, file, TYPE_BLOB); if (params == null) { params = new HashMap<String, Object>(); json = "文件已上傳過(guò)"; params.put("status", "fail"); params.put("data", json); json = writer.writeValueAsString(params); return json.toString(); } try { json = writer.writeValueAsString(params); // json = (String) params.get("data"); } catch (Exception e) { logger.error("轉(zhuǎn)換Blob上傳參數(shù)為JSON時(shí)發(fā)生異常,Cause: ", e); } if (StringUtils.isBlank(callback)) { return json.toString(); } else { return callback + "(" + json.toString() + ");"; } } // 還沒(méi)上傳文件的 params.put("status", "fail"); params.put("data", json); json = writer.writeValueAsString(params); return json.toString(); } }
預(yù)覽圖代理輸出-----處理類:
package com.document.handle.controller; import java.io.File; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import com.document.tool.ImageMagickUtils; import com.document.tool.SystemConfig; @Controller public class ImageAgentController { private static final Logger LOG = LoggerFactory.getLogger(ImageAgentController.class); /** * ppt預(yù)覽圖片代理輸出 * @throws IOException */ @RequestMapping("/preview/images/{year}/{month}/{md5id}/{preview}/{filename}.{ext}") public void cropImage(@PathVariable String year, @PathVariable String month, @PathVariable String md5id,@PathVariable String preview, @PathVariable String filename, @PathVariable String ext, HttpServletRequest request, HttpServletResponse response) throws IOException { //String rootDir = "/data05/ovp/images/"; String rootDir = SystemConfig.getBlobDirectory(); String oname = filename.substring(1,filename.length());//原圖文件名 String dirString = rootDir + year+"/" +month + "/" + md5id + "/"+oname+"." + ext; String targetFileString = rootDir + year+"/" +month + "/" + md5id + "/preview/" + filename + "." + ext; LOG.info("corpImage..." + dirString + " -> " +targetFileString ); File newfile = new File(targetFileString); String pathString = newfile.getParent(); LOG.info("pathString...{} {}" , pathString); File pathFile = new File(pathString); if(!pathFile.exists()){ LOG.info("---create file---"); pathFile.mkdirs(); } boolean status = ImageMagickUtils.scale(dirString, targetFileString, 240, 180); if(status){ response.reset(); response.setContentType("image/" + ext); java.io.InputStream in = new java.io.FileInputStream(targetFileString); //FilenameUrlUtils.getImageFilename(targetFileString); if ( in != null ) { byte[] b = new byte[1024]; int len; while( (len = in.read(b)) != -1 ) { response.getOutputStream().write(b); } in.close(); } } } }
提取文字大綱的perl腳本:
use strict; use warnings; use utf8; use open ':encoding(utf8)'; binmode(STDOUT, ":utf8"); sub trim($) { my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; } if(!$ARGV[0]){ die; } open my $fh, "pdftotext -layout -enc UTF-8 $ARGV[0] - |" or die $!; my $firstline=<$fh>; print trim($firstline); my $pageNum = 1; while ( my $line = <$fh> ) { if ( $line =~ /\xC/ ) { my $count = ($line =~ tr/\xC//); for(my $i=0;$i<$count-1;$i++){ print "http:///".$pageNum; $pageNum++; } if(trim($line)){ print "http:///".trim($line); } $pageNum++; } } close $fh;
可能遇到的問(wèn)題:
1、ppt轉(zhuǎn)pdf時(shí),遇到啟動(dòng)失?。ú磺宄遣皇窃俅螁?dòng)引起的)
2、轉(zhuǎn)換后的pdf 表格里的中文會(huì)出現(xiàn)亂碼
3、有時(shí)會(huì)出現(xiàn)關(guān)閉服務(wù)器的所用服務(wù)(尚不清楚什么原因引起的)
4、處理請(qǐng)求時(shí),經(jīng)常出現(xiàn)超時(shí)504
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
Java元素排序Comparable與Comparator的區(qū)別
這篇文章主要介紹了Java元素排序Comparable與Comparator的區(qū)別,二者都是頂級(jí)的接口,但擁有的方法和用法是不同的,下面我們分別來(lái)看看具體是怎樣的區(qū)別吧2022-05-05使用@Service注解出現(xiàn)No bean named 'xxxx'&
這篇文章主要介紹了使用@Service注解出現(xiàn)No bean named 'xxxx' available]錯(cuò)誤的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-08-08java 注解annotation的使用以及反射如何獲取注解
這篇文章主要介紹了java 注解annotation的使用以及反射如何獲取注解的相關(guān)資料,需要的朋友可以參考下2017-01-01java調(diào)用Oracle存儲(chǔ)過(guò)程的方法實(shí)例
這篇文章介紹了java調(diào)用Oracle存儲(chǔ)過(guò)程的方法實(shí)例,有需要的朋友可以參考一下2013-09-09Java設(shè)計(jì)模式中裝飾者模式應(yīng)用詳解
裝飾者模式:在不改變?cè)袑?duì)象的基礎(chǔ)之上,動(dòng)態(tài)的將功能附加到對(duì)象上,提供了繼承更有彈性的替代方案,也體現(xiàn)了開(kāi)閉原則。本文將通過(guò)示例詳細(xì)講解一下裝飾者模式,需要的可以參考一下2022-11-11Spring Boot2配置服務(wù)器訪問(wèn)日志過(guò)程解析
這篇文章主要介紹了Spring Boot2配置服務(wù)器訪問(wèn)日志過(guò)程解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2019-11-11spring/springboot整合curator遇到的坑及解決
這篇文章主要介紹了spring/springboot整合curator遇到的坑及解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-05-05