自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

sky

风尘仆仆 平心静气

  • 博客(25)
  • 收藏
  • 关注

原创 spriingboot -- spring-security 对页面资源的认证与授权

参考于和感谢此博主:https://www.cnblogs.com/zimug/p/11870861.html1、引入依赖和版本:1)、properties <properties> <java.version>1.8</java.version> <thymeleaf.version>3.0.9.RELEASE</thymele...

2020-01-30 21:54:22 360

原创 springboot -- 定时执行

1、主程序添加 @EnableSchedulingpackage com.example;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.sche...

2020-01-30 08:13:32 167

原创 springboot --发送邮件

1、引入依赖: <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-mail --> <dependency> <groupId>org.springframework.boot</groupId> &...

2020-01-29 17:28:50 323

原创 springboot -- 方法异步设置

1、主程序添加 @EnableAsync 开启异步package com.example;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.sched...

2020-01-29 16:35:05 334

原创 springboot -- 检索 Elasticsearch 初了解

一、用 jest 来作为检索工具1、引入依赖: <!-- https://mvnrepository.com/artifact/io.searchbox/jest --> <dependency> <groupId>io.searchbox</groupId> <artifactId>jest</a...

2020-01-28 20:27:56 167

原创 springboot -- Redis初了解与使用

1、启用Redis服务切换路径: cd /d F:\Redis开启Redis: redis-server.exe redis.windows.conf1、导入相关依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-...

2020-01-23 15:01:07 126

原创 springboot -- Cache缓存初了解

1、了解缓存缓存是为了提高运行性能:调用在缓存中已有的数据从而减少对数据库的操作。一个缓存管理器管理着多个缓存组件, 每个缓存组件有多个key, value键值对。举一个例子:一个公司(缓存管理器)有多个部门(缓存组件)它们都有自己的部门名称(cacheName),每个部门也有多个职员(key, value键值对)。其中键值对的储存方式是:key默认是方法参数的值的字符串, valu...

2020-01-22 09:28:55 269

原创 springboot -- 自定义starter

1、创建两个空项目 start、autoStart1)两个项目的关系是:start引用autoStart, 使用者只需要引用start即可2)相当于start为接口, 而实现它的是autoStart2、autoStart文件目录1)依赖引入 <!--spring-boot-starter是所有starter都要引入的基本配置 --> <dependency&g...

2020-01-20 14:17:25 131

原创 springboot -- JPA简单运用

1、导入相关依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> ...

2020-01-19 18:27:10 164

原创 springboot --Mybatis注解版和配置文件版

1、创建一个Mapper接口类package com.example.mapper;import org.apache.ibatis.annotations.Delete;import org.apache.ibatis.annotations.Insert;import org.apache.ibatis.annotations.Options;import org.apache.i...

2020-01-18 20:36:38 436

转载 连接mysql 出现:java.sql.SQLException: Unable to load authentication plugin 'caching_sha2_password'.

<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.11</version></dependency>

2020-01-17 14:48:09 308

原创 springboot -- 自定义(可预知和不可预知) Exception 异常的抛出和统一捕获处理

1、首先自定义一个异常:public class UserNoExit extends RuntimeException{ public UserNoExit() { super("Not Exit..."); }}2、此处抛出一个异常:@ResponseBody@RequestMapping("/nihao")public String aa(@RequestParam(...

2020-01-13 23:18:13 1020

原创 springboot -- 异常错误页面初了解

通常我们的运行项目时映射地址输错了或者数据问题等等就会出现这个错误页面。而这个页面是springboot默认展示的页面。我们也可以利用 模板引擎 制作一个属于自己的错误页面在templates文件夹下创建error文件, 里面有404.html和4xx.html文件。(为什么要创建在这? 因为mvc的自动配置错误页面默认路径就是error文件夹下的与以状态码名字相关的html文件, 如...

2020-01-13 23:03:33 117

原创 springboot --前后端传输实体对象中引用对象无法被解析问题

除了添加getter和setter以外,有时候要注意一下自己如果另行添加了一个构造方法的话也要再创建一个空构造方法, 否则该对象无法被解析

2020-01-13 12:46:46 936

转载 springboot -- 后端接收前端字符串时间并且转换成Date

@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")@DateTimeFormat(pattern = "yyyy-MM-dd")private Date birth;在实体Date类型属性上加@JsonFormat(pattern = “yyyy-MM-dd”, timezone = “GMT+8”)@DateTimeForm...

2020-01-13 10:49:34 6638

原创 springboot -- 用@RerquestBody接收前端数据 ajax的写法

$.ajax({ url:"addUser", type:"POST", data:JSON.stringify(data), contentType:"application/json", //缺失会出现URL编码,无法转成json对象 success:function(data){ ...

2020-01-11 19:49:50 686

原创 springboot -- 前后端接收数据

前言写一个项目总会编写前后端接收数据的, 但方法有很多, 但为了目前减轻一下我的脑子的压力, 我准备统筹一种方法去面对大部分前后端接收数据的方法正文后端@ResponseBody@PostMapping("/addUser") public User addUser(User user, String wocao){ //包装好的user对象 System.out.printl...

2020-01-11 19:34:42 577

原创 springboot -- thymeleaf重新跳转时的bug

出现这种情况有两种可能:1、像网上说的: 没有引用模板引擎的语句<html lang="en" xmlns:th="http://www.thymeleaf.org">2、<div th:text="${user.account}">这里显示欢迎信息</div>你没有把 user 对象传送到该页面中, 当 user 调用 account 属性时因为 u...

2020-01-11 12:05:17 130

原创 springboot -- 拦截器(HandlerInterceptor)

前言拦截器一般用于检测用户是否有登录, 防止未登录时用户直接输入映射地址跳转到需要登录的页面正文package com.atguigu.springboot.component;import org.springframework.web.servlet.HandlerInterceptor;import org.springframework.web.servlet.ModelAnd...

2020-01-10 12:19:13 417

原创 springboot --根据配置文件切换语言

一、配置语言文件在 resources 文件夹下创建一个文件夹local(自定义名称)来装三个配置文件success_en_US.properties文件(英文)success.name=Mr.Huangsuccess_zh_CN.properties(中文)success.name=\u9EC4\u5FA1\u633Asuccess.properties(默认中文)succe...

2020-01-10 10:52:39 802

原创 springboot --前端网页引用jar包依赖的做法

百度搜索 webjars 官网, 然后获取自己对应jar的依赖。比如Bootstrap<dependency> <groupId>org.webjars</groupId> <artifactId>bootstrap</artifactId> <version>4.4.1</version&g...

2020-01-09 19:25:15 740

原创 springboot -- 利用WebMvcConfigurerAdapter页面对于单纯的跳转功能的简化配置

@RequestMapping(value="/index") public String index(){ return "index"; }之前如果要单纯直接跳转一个页面的话要写一个映射方法, 但如果类似的要跳转很多个页面的话就要写很多个映射方法了@Configurationpublic class AdminPageController extends WebMvc...

2020-01-09 18:59:32 157

原创 springboot -- thymeleaf模板引擎的配置与使用

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>在pom.xml加入thymeleaf依赖<p...

2020-01-09 13:59:33 217

原创 springboot日志

springboot日志Logger logger = LoggerFactory.getLogger(getClass()); @Test public void contextLoads() { logger.trace("这是trace日志"); logger.debug("这是debug日志"); logger.info("这是Info日志"); logge...

2020-01-08 14:26:41 110

原创 获取URL地址栏参数

//获取地址栏参数的函数 function getUrlParms(para){ var search=location.search; //页面URL的查询部分字符串 var arrPara=new Array(); //参数数组。数组单项为包含参数名和参数值的字符串,如“para=value” var arrVal=new Array(); //参数值数组...

2020-01-03 16:04:11 219

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除