随笔分类 - springboot
摘要:1.模块安装 npm install crypto-js 2.新建插件secret.js import CryptoJS from 'crypto-js' // 默认的 KEY 与 iv 如果没有给 const KEY = CryptoJS.enc.Utf8.parse("1234567890123
阅读全文
摘要:1.新建拦截器配置类: WebMvcConfigurer import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import o
阅读全文
摘要:1.SpringBoot使⽤用注解⽅方式开启定时任务 @SpringBootApplication @ServletComponentScan //启动类⾥里里⾯面 @EnableScheduling开启定时任务,⾃自动扫描 @EnableScheduling public class Demo00
阅读全文
摘要:1.springboot启动类里面使用@EnableAsync注解开启异步功能 @EnableAsync public class Demo001Application { public static void main(String[] args) { SpringApplication.run(
阅读全文
摘要:1.Thymeleaf介绍(官网推荐:https://www.thymeleaf.org/doc/articles/thymeleaf3migration.html) Thymeleaf是跟Velocity、FreeMarker类似的模板引擎,它可以完全替代JSP,相较与其他的模板引擎,它主要有以下
阅读全文
摘要:1.freemarker介绍 Apache FreeMarker是一款开源的模板引擎:即一种基于模板和要改变的数据,并用来生成输出文本(HTML网页,电子邮件,配置文件,源代码等)的通用工具。它不是面向最终用户的,而是一个java类库,是一款程序员可以嵌入他们所开发产品的组件。模板使用FreeMar
阅读全文
摘要:一、全局异常处理 //Result定义全局数据返回对象 package com.xiaobing.demo001.domain; public class Result { private Integer code; private String message; private Object da
阅读全文
摘要:一、配置文件加载 1、Controller中配置并指向文件 @Controller @PropertySource(value = { "application.properties" })//指定配置文件 2、在变量上打注解并指明配置文件中的key @Value("${web.upload.fil
阅读全文
摘要:1、引入热部署依赖包 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependen
阅读全文
摘要:1、静态文件 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>文件上传</title> </head> <body> <form enctype="multipart/form-data" method="post" actio
阅读全文
摘要:1、目录 src/main/java :存放java代码 src/main/resources static:存放静态文件,比如css、js、image(访问方式 http://localhost:8080/js/main.js) templates:存放静态页面jsp,html,tpl confi
阅读全文
摘要:1.新建项目,项目中实战讲解注解作用 2.pom.xml依赖配置 <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <parent> <groupId>org.s
阅读全文
摘要:1. springboot自动创建地址:https://start.spring.io/ 2.选择web(springMVC) 3.点击创建 4.创建成功 5.解压,导入项目 6.新建成功 7.原因 : maven的插件版本的问题,造成与IDE的不兼容 解决办法 :在pom中加上 <maven-ja
阅读全文
摘要:1.打开Eclipse新建maven项目 2.导入maven依赖 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0
阅读全文
摘要:springboot官方文档:https://spring.io/guides/gs/spring-boot/ springbootGitHub地址:https://github.com/spring-projects/spring-boot Spring Boot Spring Boot make
阅读全文