
springboot
hlvy
这个作者很懒,什么都没留下…
展开
-
spring cloud alibaba跨域问题
spring cloud alibaba跨域问题原创 2023-02-15 11:36:55 · 262 阅读 · 0 评论 -
springboot2.x 消费dubbo接口(只做消费)
springboot2.x 消费dubbo接口(只做消费)原创 2023-02-06 11:22:10 · 190 阅读 · 0 评论 -
springboot 发送验证码 redis控制在规定时间内的短信发送规定次数思路
直接看代码吧 以下代码只是思路 不能直接使用 使用redis的思路: 主要看这个方法sendCount 这里会会判断 多少小时内redis key存在多少如果超过了多少条则返回false 如果key的value不在传入的规定的时间 内则移除最前面添加的接着在最后面发送短信之后往KEY里面右侧添加数据 注意这里的redis类型是list @Resource private AliyunPropert aliyunPropert; /** * sig...原创 2020-12-10 17:41:06 · 1689 阅读 · 1 评论 -
springboot2.3 集成redisson分布式锁 自定义注解形式
这里不介绍redis的配置集成至介绍redisson分布式锁主要依赖 <!--redis--><dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <!--分布式锁redi.原创 2020-12-04 11:11:48 · 1177 阅读 · 0 评论 -
Hutool生成图片二维码 输出到前端
文档地址https://hutool.cn/docs/#/extra/%E4%BA%8C%E7%BB%B4%E7%A0%81%E5%B7%A5%E5%85%B7-QrCodeUtilpom引入hutool jar<dependency> <groupId>cn.hutool</groupId> <artifact...原创 2019-12-16 15:53:15 · 9392 阅读 · 2 评论 -
springboot html 动态数据转pdf
需要的jar <!-- freemarker,生成 html --> <dependency> <groupId>org.freemarker</groupId> <artifactId>freemarker</art...原创 2019-12-04 13:33:20 · 4750 阅读 · 5 评论 -
springboot实现自定义短网址
短网址(Short URL) ,顾名思义就是在形式上比较短的网址。通常用的是asp或者php转向,在Web 2.0的今天,不得不说,这是一个潮流。目前已经有许多类似服务,借助短网址您可以用简短的网址替代原来冗长的网址,让使用者可以更容易的分享链接。用于短信 有限制字数的地方代码实现:首先在mysql创建一张短网址表:CREATE TABLE `short_link` ( `id...原创 2019-11-12 16:49:18 · 1643 阅读 · 0 评论 -
uiditor百度富文本所有选项无法选择
在ueditor.config.js加上zIndex:99999参考文章:http://facer.me/1270.html原创 2019-11-01 13:59:10 · 282 阅读 · 0 评论 -
springboot打成jar包后读取配置resources下的文件
之前是这样读取的 打成jar放到linux 报路径问题,jar包找不到classpath的路径String rootPath = this.getClass().getResource("config.json").getPath();response.getWriter().write(readFile(inputStream)); public String readFi...原创 2019-11-01 13:56:52 · 1766 阅读 · 0 评论 -
springboot2.x教程
在线文档地址:https://loren123.gitbook.io/hlvy/github地址:https://github.com/heng1234/springboot2.x 项目地址 springboot介绍 springboot集成lombok springboot基础配置 springboot使用banner ...原创 2019-10-17 14:50:07 · 472 阅读 · 0 评论 -
微信短链接
将一条长链接转成短链接。主要使用场景: 开发者用于生成二维码的原链接(商品、支付二维码等)太长导致扫码速度和成功率下降,将原长链接通过此接口转成短链接再生成二维码将大大提升扫码速度和成功率。接口调用请求说明开发者可通过OpenID来获取用户基本信息。请使用https协议。http请求方式: POSThttps://api.weixin.qq.com/cgi-bin/shortu...翻译 2019-10-16 11:18:56 · 1522 阅读 · 0 评论 -
Spring Boot中使用缓存
准备工作搭建一个Spring Boot项目,然后yml中配置日志输出级别以观察SQL的执行情况:logging: level: com: springboot: mapper: debug其中com.spring.mapper为MyBatis的Mapper接口路径。然后编写如下测试方法:@RunWith(SpringJUnit4Cl...转载 2019-10-15 18:51:12 · 240 阅读 · 0 评论 -
Spring Boot AOP记录用户操作日志
在Spring框架中,使用AOP配合自定义注解可以方便的实现用户操作的监控。首先搭建一个基本的Spring Boot Web环境开启Spring Boot,然后引入必要依赖: <!-- aop依赖 --> <dependency> <groupId>org.springframework.boot</groupId&g...转载 2019-10-15 17:49:20 · 1627 阅读 · 0 评论 -
Spring Boot MyBatis配置Druid多数据源
application.ymlserver: context-path: /web port: 7001spring: datasource: druid: # 数据库访问配置, 使用druid数据源 # 数据源1 mysql mysql: type: com.alibaba.druid.pool.DruidDataS...转载 2019-10-15 16:55:47 · 360 阅读 · 0 评论 -
springboot druid数据源 mysql版
sqlCREATE TABLE STUDENT ( SNO VARCHAR(3) NOT NULL , SNAME VARCHAR(9) NOT NULL , SSEX CHAR(2) NOT NULL );INSERT INTO STUDENT VALUES ('001', 'KangKang', 'M ');INSERT INTO STUDENT VALU...翻译 2019-10-14 17:27:38 · 272 阅读 · 0 评论 -
Springboot整合freemarker
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解配置文件Properties 配置############################################################## freemarker 静态资源配置#################...翻译 2018-09-06 09:57:25 · 239 阅读 · 0 评论 -
springboot多模块化
首先创建一个springboot项目结构如下User:package com.hlvy.dmkh.entity;/** * User * * @author heng **/public class User { private String name; private int age; public User() { } ...原创 2018-11-02 10:38:10 · 2670 阅读 · 0 评论 -
SpringBoot 外置tomcat引入本地jar包不了的解决办法
问题: springboot多模块项目(内置tomcat可以 但是需要把jar加入主模块) 外置tomcat 引入后启动运行后调接口方的方法时说找不到这个方法 排查后是jar没引入进来(外置的加入主模块也无效果)可是我这用idea的方式引入jar这样引入的jar(idea引入方式具体百度)后面在jar扔到tomcat 也没用 还报jar冲突 但是我把引入的都删了 才扔到tomc...原创 2018-11-29 14:32:03 · 1773 阅读 · 0 评论 -
idea打包springboot项目 war
这是我新建的项目首先pom的jar改为war接着把项目起来点build---build art… 点rebuild WAR就出来了 自定义war包名1、 取个名字 2、for 刚刚取的项目名 3、rebuild一下 打好的war在这个路径下面 这样就ok了 ...原创 2018-12-18 11:37:25 · 644 阅读 · 0 评论 -
ava.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized ...解决方案
原文:https://blog.youkuaiyun.com/liyagangcsdn/article/details/88364510报错信息: ava.sql.SQLException: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more ...解决方案:通过指定时区url: j...转载 2019-04-11 17:50:35 · 796 阅读 · 0 评论 -
springboot项目 mybatis_plus自动生成entity service controller mapper mapper.xml
github地址:https://github.com/heng1234/mybatis_pluspackage com.hlvy.mybatis_plus.generator;import com.baomidou.mybatisplus.annotation.DbType;import com.baomidou.mybatisplus.core.exceptions.Mybatis...原创 2019-04-17 11:18:11 · 1130 阅读 · 0 评论 -
springboot 代码读取读取yml文件
配置configpackage com.ljzforum.platform.config;import com.ljzforum.platform.util.CustomizedPropertyConfigurer;import org.springframework.beans.factory.annotation.Autowired;import org.springframe...原创 2019-08-19 16:49:12 · 2754 阅读 · 0 评论 -
redis+springboot生成图片验证码
html代码<div style="margin-left: 10px;"><img id="verifyCodeImg" src="./initVerifyCode" class="layadmin-user-login-codeimg" onclick="refreshVerifyCode()"></div><script> ...原创 2019-08-29 11:25:53 · 1560 阅读 · 6 评论 -
maven互相依赖
A的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://mav原创 2018-11-02 09:27:42 · 607 阅读 · 0 评论 -
@JsonProperty序列化和反序列化
@JsonProperty("this_name")private String thisName; 被注解标识后,controller返回序列化参数后变为this_name,当接受application/json编码格式的参数时,同样需要接收参数为this_name的参数.但是当用表单提交时,则必须传thisName或ThisName才能接收原文:https:...转载 2018-10-26 17:06:15 · 3305 阅读 · 0 评论 -
整合MyBatis - 实现基于mybatis的CRUD功能
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解 pom文件:<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="ht...翻译 2018-09-06 10:26:44 · 245 阅读 · 0 评论 -
整合MyBatis - 使用generatorConfig生成mapper以及pojo
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解pom文件引入 <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> ...翻译 2018-09-06 10:21:31 · 467 阅读 · 0 评论 -
SpringBoot配置全局的异常捕获 - 同时兼容web与ajax
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解结合前面2个web和ajax处理看异常处理类package com.yh.exception;import javax.servlet.http.HttpServletRequest;import javax.servlet.htt...翻译 2018-09-06 10:13:25 · 620 阅读 · 3 评论 -
SpringBoot配置全局的异常捕获 - ajax形式
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解异常处理类:package com.yh.exception;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletRespo...翻译 2018-09-06 10:08:58 · 439 阅读 · 0 评论 -
SpringBoot配置全局的异常捕获 - web页面跳转
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解ErrorController/** * 不是ajax形式访问 * @return */ @RequestMapping("err") public String error() { int res = 1 / 0;...翻译 2018-09-06 10:03:05 · 664 阅读 · 0 评论 -
eclipse springboot 热部署方法
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解 <!-- 热部署 --> <!-- devtools可以实现页面热部署(即页面修改后会立即生效, 这个可以直接在application.properties文件中配置spring.thymeleaf.cache=fa...翻译 2018-08-25 17:11:57 · 1215 阅读 · 0 评论 -
SpringBoot 资源文件配置server以及tomcat
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解 ############################################################## Server 服务端相关配置#########################################...翻译 2018-08-28 15:05:08 · 14166 阅读 · 1 评论 -
Springboot 资源配置
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解 Pom.xml引入 <!-- 用于读取配置文件包--> <dependency> <groupId>org.springframework.boot</groupId> <...翻译 2018-08-28 15:04:07 · 197 阅读 · 0 评论 -
Springboot jackson
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解 @@JsonIgnore controller返回对象会忽略对象里属性有这个注解的格式化次标有此注解date类型的属性@JsonFormat(pattern="yyyy-MM-dd hh:mm:ss a", locale="zh...翻译 2018-08-28 14:57:33 · 692 阅读 · 0 评论 -
整合MyBatis - 使用pagehelper实现分页
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解 pom需要加入pagehelper的jar service/** * 分页查询 */ @Override @Transactional(propagation=Propagation.SUPPORTS) publi...翻译 2018-09-06 10:29:53 · 302 阅读 · 0 评论 -
整合MyBatis - 自定义mapper的实现
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解 这里不用进行配置了因为在启动类进行了全包扫描 Mapper定义一个mapper接口 package com.yh.mapper;import java.util.List;import com.yh.pojo.TUs...翻译 2018-09-06 10:43:11 · 2513 阅读 · 0 评论 -
整合MyBatis - 引入事务执行回滚
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解 Service上加上事务注解 @Transactional(propagation = Propagation.xxx) 例如 @Transactional(propagation = Propagation.RE...翻译 2018-09-06 10:43:51 · 1300 阅读 · 0 评论 -
idea中springboot项目使用lombok 插件
lombok 作用通过lombok注解减少getter、setter等方法的编写,在更改实体类时只需要修改属性即可,减少了很多重复代码的编写工作编译时会自动生成getter、setter等方法 收先在idea安装lombok 插件接着把enable...这个勾上 如图 在pom.xml加上lombok 的jar <!--lombok--> ...翻译 2018-10-26 13:16:00 · 2244 阅读 · 0 评论 -
springboot+dubbo+thymeleaf模板+bootstrap+mysql数据库+redis缓存数据库 项目例子
做了增删改查及redis缓存 处理了缓存穿透问题 项目直接可运行github地址: https://github.com/heng1234/springboot原创 2018-10-03 21:45:30 · 435 阅读 · 0 评论 -
springboot中如何使用拦截器
请结合springboot学习教程项目github地址 https://github.com/heng1234/spring-boot_one来理解 WebMvcConfigurerpackage com.imooc.config;import org.springframework.context.annotation.Configuration;import org....翻译 2018-09-07 17:28:35 · 813 阅读 · 0 评论