
SpringBoot
gf771115
这个作者很懒,什么都没留下…
展开
-
spring boot 使用redis作为cache 出现:A cannot be cast to A.使用fastJson序列化
今天在使用spring boot+spring-data-redis 做缓存,在获取缓存的时候出现了:java.lang.ClassCastException: com.xxx.www.xxx.entity.Sign cannot be cast to com.xxx.www.xxx.entity.Sign的异常,记录一下解决思路以及方案。首先,出现这个问题,因为类的全名和路径都一样,那么根据...转载 2020-04-24 13:31:17 · 2258 阅读 · 5 评论 -
SpringBoot基本操作(五)——SpringBoot使用Jedis整合Redis(有demo)
SpringBoot2.0笔记(一)SpringBoot基本操作——环境搭建及项目创建(有demo)(二)SpringBoot基本操作——使用IDEA打war包发布及测试(三)SpringBoot基本操作——SpringBoot整合SpringDataJpa(有demo)(四)SpringBoot基本操作——SpringBoot使用RedisTemplate整合Redis(有demo...转载 2020-04-21 17:36:30 · 1012 阅读 · 0 评论 -
springboot之使用redistemplate优雅地操作redis
概述本文内容主要关于spring-redis 关于redis的key设计 redis的基本数据结构 介绍redis与springboot的整合 sringboot中的redistemplate的使用之前看了很多博客,大都都只是粗略的介绍,这里想要记录的全面一些,也算是一个学习的过程首发于我的个人博客:janti的个人博客关于spring-redisspring-data...转载 2020-04-21 16:53:16 · 385 阅读 · 0 评论 -
idea maven 打包 引用本地jar
1将本地jar包导入到mvn本地库mvn install:install-file -Dfile=/Users/liuqiang/Documents/gmpl/gmpl-server/lib/alipay-sdk-java20170307171631.jar-DgroupId=alipay -DartifactId=alipay -Dversion=20170307171631 -Dpack...转载 2020-04-17 16:22:39 · 1499 阅读 · 1 评论 -
springboot中controller的使用
一、知识点1 @Controller 处理http请求(不推荐使用) 2 @RestController spring4之后新加的注解,原来返回json需要@ResponseBody配合@Controller 3 @RequestMapping 配置Url映射 4 @GetMapping 当 在方法上的注释时@RequestMappi...转载 2020-04-16 11:30:31 · 1110 阅读 · 0 评论 -
springboot集成restTemplate实现rest接口调用
一restTemplate简介restTemplate底层是基于HttpURLConnection实现的restful风格的接口调用,类似于webservice,rpc远程调用,但其工作模式更加轻量级,方便于rest请求之间的调用,完成数据之间的交互,在springCloud之中也有一席之地。大致调用过程如下图,如果想学习其底层具体如何实现可以查看我的文章restTemplate源码详解...转载 2020-04-15 14:08:16 · 301 阅读 · 0 评论 -
springboot(服务端接口)获取URL请求参数的几种方法
1、直接把表单的参数写在Controller相应的方法的形参中,适用于get方式提交,不适用于post方式提交。 /** * 1.直接把表单的参数写在Controller相应的方法的形参中 * @param username * @param password * @return */ @RequestMapping("/...转载 2020-04-15 11:37:34 · 1437 阅读 · 0 评论 -
springboot服务内部调用
ublic static void main(String[] args) { Map<String ,Object> map = new HashMap<>(); RestTemplate restTemplate = new RestTemplate(); map.put("money",30); map.put("currency","...转载 2020-04-15 10:56:02 · 1493 阅读 · 0 评论 -
通过Spring boot编码获取当前程序运行的host和端口号
1简介在使用Java开发过程中,一般在程序内部数据的传输会使用Http协议,通过三层结构,Controller-Service-Dao层,由于自己编写的jar包在部署到其他机器上时运行的主机和端口号可能会发生变化,虽然在开发时可以使用硬编码写入自己的代码中,但这种实现确实不佳。好在Spring Boot提供了一个接口ApplicationListener,来监听项目的启动,通过监听项目启动时的端...转载 2020-04-15 10:54:54 · 6050 阅读 · 0 评论