随笔分类 -  Springboot2

摘要:前言 最近又要对接友商老的系统,依然采用http + xml方式的请求,客方提供了xsd,这里提供windows平台两种转换xsd文件为javaBean的方式。 方法一 : xjc 命令参考: "C:\Program Files\Java\jdk1.8.0_331\bin\xjc.exe" test 阅读全文
posted @ 2023-10-12 13:51 虹梦未来 阅读(144) 评论(0) 推荐(0) 编辑
摘要:环境: SpringBoot2.5.7 SpringBootStarterDataMongo(SpringDataMongo3.2.7) 请确认您的环境,因为spingData系列迭代很快,并且一些接口,类和实现都会变更,需要针对性修改。 pom.xml 这里只贴mongo相关,boot本身的自行引 阅读全文
posted @ 2023-02-06 11:24 虹梦未来 阅读(128) 评论(0) 推荐(0) 编辑
摘要:前言: 使用Jaxb反序列化xml,处理UTF-8 with bom的文件时报错。 问题: Content is not allowed in prolog. 解决方案: public static Object convertXmlFileToObject(Class clazz, String 阅读全文
posted @ 2022-10-18 13:53 虹梦未来 阅读(16) 评论(0) 推荐(0) 编辑
摘要:使用Idea,如果遇到无法正确打包,或者无法引入依赖的,在确保maven 相关的配置没有问题的时候,可以考虑下,是否是idea与maven版本配置问题 比如 idea 2022,使用maven3.6.x 有点小问题,推荐版本3.8.x idea 2021 使用高版本3.8.x 有点小问题,推荐版本3 阅读全文
posted @ 2022-08-31 00:13 虹梦未来 阅读(89) 评论(0) 推荐(0) 编辑
摘要:环境: Windows11,JDK11,SpringBoot2.7.3,idea2021.2,maven3.6.3(过程中使用3.8.x,有一些比较恶心的问题,换回了老版本) 完整步骤: 1. 创建父工程 Idea: File->New Project -> Spring Initializr -> 阅读全文
posted @ 2022-08-21 23:24 虹梦未来 阅读(118) 评论(0) 推荐(0) 编辑
摘要:微信登录官方资料: 准备工作 | 微信开放文档 第三方参考资料: vue 微信扫码登录嵌入方式及开发踩的坑点_范特西是只猫的博客-CSDN博客_微信网页扫码登录开发文档 说明: 1. 微信官方有两种对外能力,分别是 网站应用 与 微信开放平台,这两个服务都有授权登录,注意,我们使用的是前者,故需要的 阅读全文
posted @ 2022-07-29 18:45 虹梦未来 阅读(66) 评论(0) 推荐(0) 编辑
摘要:Spring Boot 默认的source文件路径: private static final String[] CLASSPATH_RESOURCE_LOCATIONS = { "classpath:/META-INF/resources/", "classpath:/resources/", " 阅读全文
posted @ 2022-07-04 14:15 虹梦未来 阅读(94) 评论(0) 推荐(0) 编辑
摘要:SpringBoot强大特性之一便是自动配置,约定大于配置。 网上类似的文章很多,比如这篇: SpringBoot之自定义starter_小彭不会秃头的博客-CSDN博客_springboot自定义starter目录一、什么是SpringBoot starter机制二、为什么要自定义starter三 阅读全文
posted @ 2022-06-30 09:33 虹梦未来 阅读(7) 评论(0) 推荐(0) 编辑
摘要:环境: Centos7 Mysql8 登陆mysql mysql -u root -p 查看所有的用户 select HOST,user ,grant_priv from user ; 限定单ip update user set host = '限制原本无限制的root' where user = 阅读全文
posted @ 2022-06-21 18:05 虹梦未来 阅读(38) 评论(0) 推荐(0) 编辑
摘要:最近博主在项目中,遇到了java对接jsonrpc的需求,稍微折腾了下,特整理一份笔记.本文主要记录的是jsonrpc4j (github地址:GitHub - briandilley/jsonrpc4j: JSON-RPC for Java) 环境: 组件版本SpringBoot22.5.7jso 阅读全文
posted @ 2022-06-20 20:24 虹梦未来 阅读(316) 评论(0) 推荐(0) 编辑
摘要:关于Druid的使用,我们很多时候遵从默认,直接使用配置文件,直接采用如下配置 datasource: type: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver url: 'jdbc: 阅读全文
posted @ 2022-02-08 17:12 虹梦未来 阅读(5) 评论(0) 推荐(0) 编辑
摘要:在开发SpringSecurity配置的项目时,返回带有iframe的页面时,无法显示。 报错截图: 打开页面工具看到提示 Refused to display in a frame because it set 'X-Frame-Options' to 'DENY' >>>>> Springboo 阅读全文
posted @ 2021-07-30 11:22 虹梦未来 阅读(75) 评论(0) 推荐(0) 编辑
摘要:@Autowired private RedisTemplate redisTemplate; /** * 加锁 */ public boolean getLock(String key) { try { long count = redisTemplate.opsForValue().increm 阅读全文
posted @ 2021-07-22 19:17 虹梦未来 阅读(9) 评论(0) 推荐(0) 编辑
摘要:前言: yml作为现在开发中,使用较多的配置文件格式,支持多种数据,单值,数组,list,map。 配置文件中,map的写法应该是(当然还有别的): my: help: map: '{"key":"value","key1":"value1"}' 代码中获取 @Value("#{${my.help. 阅读全文
posted @ 2021-07-08 19:39 虹梦未来 阅读(4) 评论(0) 推荐(0) 编辑
摘要:环境: Spring boot 2.x 依赖: 直接引入AOP starter <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </de 阅读全文
posted @ 2021-06-07 18:41 虹梦未来 阅读(5) 评论(0) 推荐(0) 编辑
摘要:前言:昨天环西湖两圈,跑了个半马,结果这会还感觉很累。写单元测试呢,发现test路径不见了。 记录下本次单元测试的蠢事。 1.tests路径建立错误(其实这个问题不大,就是规范),贴一张maven标准目录的图。 2.springboottest注解,启动test标注的类,报错。 要注意的点有三个: 阅读全文
posted @ 2021-06-07 10:03 虹梦未来 阅读(5) 评论(0) 推荐(0) 编辑
摘要:环境:Spring data jpa 问题:jpa failed to lazily initialize a collection of role 原因: 类User Info和Role使用OneToMany时,类UserInfo中用了懒加载fetch=FetchType.LAZY,导致在类Use 阅读全文
posted @ 2021-06-01 13:59 虹梦未来 阅读(15) 评论(0) 推荐(0) 编辑
摘要:前端配置 axios默认发送请求是不携带cookie的,所以需要加上下面这句 axios.defaults.withCredentials = true; import axios from 'axios'; axios.defaults.withCredentials = true; // 允许携 阅读全文
posted @ 2021-05-12 16:57 虹梦未来 阅读(119) 评论(0) 推荐(0) 编辑
摘要:前言:项目之前使用的spring data jpa,获取id直接从实体类获取即可(动态更新),切换到mybatis后,也无需查询,只要添加useGeneratedKeys="true" keyProperty即可。 useGeneratedKeys="true" keyProperty="id" k 阅读全文
posted @ 2021-04-28 16:11 虹梦未来 阅读(14) 评论(0) 推荐(0) 编辑
摘要:前言: 最近新模块需要引入新版es,在自己建立的单独的boot工程里边,正常集成,正常处理业务。但是搬到父工程里,发现报错。 奇怪了,之前的群组工程并没有使用es或者solr啊,为啥启动不起来呢。 1.一个小儿科的问题,包路径多了一层, 导致bean注入失败。 2.工程里边包含lucene。。。。( 阅读全文
posted @ 2021-04-28 14:29 虹梦未来 阅读(20) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示