java
我刚上山
这个作者很懒,什么都没留下…
展开
-
springboot上传多个文件,以对象接收
package com.test.model.request;import io.swagger.annotations.ApiModelProperty;import lombok.Data;import org.springframework.web.multipart.MultipartFile;import java.io.Serializable;import java.util.ArrayList;import java.util.List;@Datapublic clas原创 2021-12-17 18:09:56 · 704 阅读 · 0 评论 -
Maven 打包提示出错Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test
报错:Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project contest: There are test failures.Please refer to D:\test\project\contest\target\surefire-reports for the individual test results.Please refer原创 2021-09-23 14:08:53 · 72 阅读 · 0 评论 -
java 8 List<对象>转为List<String>
方式一:List<String> ids = userList.stream().map(User::getId).collect(Collectors.toList());方式二:List<String> ids = users.stream().map(e -> e.getId()).collect(Collectors.toList());原创 2021-09-09 15:00:26 · 11747 阅读 · 0 评论 -
Caused by: java.nio.charset.MalformedInputException: Input length = 1
报错:无法启动项目Caused by: java.nio.charset.MalformedInputException: Input length = 1原因:application.yml文件编码格式有问题,改为UTF-8application.yml文件有问题,直接把其他类型的文件后缀名改为yml可能导致生成的文件有问题,可以把application.yml中的内容备份,然后删除application.yml文件,再新建一个application.yml文件,将备份的内容拷贝进去再运行项目原创 2021-09-08 15:09:19 · 3884 阅读 · 1 评论 -
Logging system failed to initialize using configuration from ‘classpath:log4j2.xml‘
报错:Logging system failed to initialize using configuration from 'classpath:log4j2.xml'方法一: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId>原创 2021-09-07 15:22:57 · 6182 阅读 · 1 评论 -
java提取图片文字
pom.xml文件添加依赖<dependency> <groupId>net.sourceforge.tess4j</groupId> <artifactId>tess4j</artifactId> <version>3.2.1</version></dependency>准备文件和图片java测试代码public static void main(String[] args转载 2021-08-30 17:00:15 · 3362 阅读 · 0 评论 -
idea Debug启动半天没反应
使用idea Debug启动项目10分钟都没启动好项目,但使用run可正常启动。解决方法:去掉“方法”的断点备注:使用ctrl + shift + F8 可打开断点管理界面转载 2021-07-13 17:04:38 · 286 阅读 · 0 评论 -
求文本相似度
import java.text.DecimalFormat;import java.util.HashMap;import java.util.Map;import java.util.Set;/** * 文本相似度 * * @Author dn * @Date 2020/7/7 10:43 * @Version 1.0 */public class SimilarUtil { /** * 求余弦相似度 * @param source 文本原内容字符串原创 2021-07-07 10:25:20 · 61 阅读 · 0 评论 -
通过xml可以直观的解析GPU信息与进程信息
通过nvidia-smi命令直接输出xml格式文本,通过xml可以直观的解析GPU信息与进程信息。 /** * 获取gpu信息(暂时只支持nvidia-smi) * * @return gpu信息集合 * @throws DocumentException xml解析错误 */ private List<GPUInfo> convertXmlToGpuObject() throws DocumentException {原创 2021-06-17 16:47:23 · 551 阅读 · 0 评论 -
websocket
websocketimport org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.web.socket.server.standard.ServerEndpointExporter;/** * @Description: 开启WebSocket支持 */@Configuration原创 2021-06-17 16:26:04 · 78 阅读 · 0 评论 -
java中以特殊符号分隔的字符串和List相互转换
举例:已逗号为例1、将逗号分隔的字符串转换为List 参考:https://www.cnblogs.com/JiangWJ/p/10802606.htmlString str = "a,b,c"; List<String> list= Arrays.asList(str.split(","));2、将List转换为逗号分隔的字符串(1) 利用Guava的Join...原创 2020-04-22 14:58:30 · 960 阅读 · 0 评论