- 博客(35)
- 资源 (5)
- 收藏
- 关注
原创 springboot(30)- 安全管理(3)- 基于数据库的认证
1 基于数据库的认证1.1 数据库添加表/*Navicat MySQL Data TransferSource Server : localhostSource Server Version : 50717Source Host : localhost:3306Source Database : securityTarget Server Type : MYSQLTarget Server Version : 50717File
2020-07-26 16:35:46 271
原创 springboot(29)- 安全管理(2)
1 多个 HttpSecurity配置类@Configurationpublic class MultiHttpSecurityConfig { @Bean PasswordEncoder passwordEncoder(){ return NoOpPasswordEncoder.getInstance(); } @Autowired protected void configure(AuthenticationManagerBuilde
2020-07-25 09:12:47 189
原创 springboot(28)- 安全管理(1)
1 spring security1.1 手工配置用户名和密码1.1.1 配置文件中配置1.1.2 代码中配置package com.tzb.security.config;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.security.config.a
2020-07-24 23:19:04 174
原创 springboot(27)- 缓存
1 Spring Cache 整合 redis1.1 配置1.2 实体类1.3 Service@Servicepublic class UserService { public User getUserById(Integer id) { System.out.println("getUserById >>>" + id); User user = new User(); user.setId(id);
2020-07-23 18:47:16 153
原创 springboot(26)- 单元测试
1 单元测试1.1 Service 测试1.2 Controller 测试测试@RunWith(SpringRunner.class)@SpringBootTestpublic class JuintApplicationTests { @Autowired WebApplicationContext wac; MockMvc mockMvc; @Before public void before() { mockMvc
2020-07-21 19:50:12 136
原创 springboot(25)- DevTools
1 DevTools 简介1.1 自定义监控资源静态资源改变时也会触发重启或者当 trigger-file 发生变化时,项目才会重启2 LiveReload自动刷新页面在浏览器装 livereload 插件3 禁用自动重启4 项目重启的全局配置...
2020-07-19 22:46:46 113
原创 springboot(24)- 构建 RESTful 服务
1 基于 JPA 的RESTful依赖<dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.10</version> </dependency>
2020-07-19 10:38:28 221
原创 springboot(23)- 整合 redis
1 springboot 整合 redis1.1 redis 配置文件1.2 Controller@RestControllerpublic class HelloController { @Autowired StringRedisTemplate stringRedisTemplate; @GetMapping("/set") public void set(){ ValueOperations<String,String&
2020-07-18 21:35:27 128
原创 vuejs (3)- 综合案例
1 数据库和表DROP TABLE IF EXISTS `user`;CREATE TABLE `user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `age` int(11) DEFAULT NULL, `username` varchar(20) DEFAULT NULL, `PASSWORD` varchar(50) DEFAULT NULL, `email` varchar(50) DEFAULT NULL, `sex` varch
2020-07-16 16:28:55 421
原创 vuejs (2)- Vue 生命周期 和 VueJS ajax
1 Vue 生命周期每个 Vue 实例在被创建之前都要经过一系列的初始化过程.8 个生命周期的执行点4个基本的4个特殊的2 VueJS ajax2.1 vue-resourcevue-resource是Vue.js的插件提供了使用XMLHttpRequest或JSONP进行Web请求和处理响应的服务。 当vue更新到2.0之后,作者就宣告不再对vue-resource更新,而是推荐的axios,2.2 axiosAxios 是一个基于 promise 的 HTTP 库,可以用在浏览
2020-07-16 08:56:29 215
原创 vuejs (1)- 常用系统指令
1 VueJS介绍Vue.js是一个构建数据驱动的 web 界面的渐进式框架。Vue.js 的目标是通过尽可能简单的 API 实现响应的数据绑定和组合的视图组件。它不仅易于上手,还便于与第三方库或既有项目整合。1.1 MVVM模式MVVM是Model-View-ViewModel的简写。它本质上就是MVC 的改进版。MVVM 就是将其中的View 的状态和行为抽象化,将视图 UI 和业务逻辑分开。MVVM模式和MVC模式一样,主要目的是分离视图(View)和模型(Model)。Vue.js 是一
2020-07-12 11:09:52 206
原创 springboot(21)- 整合持久层(2)- 整合MyBatis
1 整合MyBatis1.1 依赖<dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> <version>5.1.49</version>
2020-07-08 23:38:59 203
原创 springboot(20)- 整合持久层(1)- 整合 JdbcTemplate
1 整合 JdbcTemplate1.1 jdbc 版本 <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> <version>5.1.49&l
2020-07-07 23:52:33 185
原创 springboot(19)- 整合web开发(11)- 欢迎页
1 欢迎页Controller@Controllerpublic class HelloController { @GetMapping("/index") public String hello(){ return "index"; }}2 自定义浏览器图标https://tool.lu/favicon/
2020-07-07 20:05:12 139
原创 springboot(18)- 整合web开发(10)- 整合 AOP
1 整合 AOP<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </dependency>Service@Servicepublic class UserService { public
2020-07-07 11:36:01 172
原创 springboot(17)- 整合web开发(9)- 整合web基础组件
1 整合 web 基础组件@WebServlet(urlPatterns = "/myservlet")public class MyServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { System.out.println(
2020-07-07 11:05:00 182
原创 springboot(15)- 整合web开发(7)- 加载 xml 配置,注册拦截器
1 加载 xml 配置文件package com.tzb;public class SayHello { public String sayHello(){ return "hello xml"; }}beans.xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns
2020-07-06 23:35:31 474
原创 springboot(13)- 整合web开发(5)- 自定义异常
1 异常处理1.1 静态页面Controller@RestControllerpublic class HelloController { @GetMapping("/hello") public String hello() { int i = 1 / 0; return "hello"; }}1.2 动态页面<dependency> <groupId>org.springf
2020-07-06 00:39:26 211
原创 springboot(12)- 整合web开发(4)- @ControllerAdvice
1 @ControllerAdvice 3 种用法处理全局异常预设全局数据请求参数预处理2 全局异常处理依赖<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>异常页面
2020-07-05 22:52:10 176
原创 springboot(11)- 整合web开发(3)- 文件上传
1 文件上传1.1 案例页面<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>文件上传</title></head><body><form action="/myupload" method="post" enctype="multipart/form-data">
2020-07-04 11:46:27 193
原创 springboot(9)- 整合web开发(1)- json 解析
1 springboot 默认 json 解析方案1.1 返回 json数据实体类Controller//@Controller@RestControllerpublic class UserController { @GetMapping("/getAll") // @ResponseBody public List<User> getAll() { List<User> users = new ArrayList
2020-07-03 23:16:40 283
原创 springboot(6)- 整合视图层(1)- freemarker
1 整合 freemarker1.1 新建 module1.2 简单分析2 案例2.1 实体类和Controller实体类Controller@Controllerpublic class UserController { @GetMapping("/user") public String user(Model model){ List<User> users = new ArrayList<>();
2020-07-02 22:14:00 138
原创 springboot(4)- yaml 配置
1 yaml 配置yaml配置是有序的,properties 配置是无序的自定义的yaml 目前暂时不支持使用注解直接注入到 spring boot 项目1.1 yaml 注入属性单元测试@SpringBootTestclass SpringbootTestApplicationTests { @Autowired private RedisCluster cluster; @Test void contextLoads() {
2020-07-01 23:54:46 250
原创 springboot(2)- springboot 项目创建方法
1 springboot 项目创建的3种方法1.1 在线创建https://start.spring.io/1.2 通过IDE创建1.2.1 IDEA创建 springboot项目1.2.2 STS 创建 springboot项目1.3 改造普通 maven 工程添加依赖<parent> <groupId>org.springframework.boot</groupId> <artifact
2020-07-01 10:20:29 167
原创 springboot(1)- 纯 java 编写 SSM
不需要 spring 的xml不需要 web.xml1 新建工程2 pom<?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://maven.apache..
2020-07-01 09:46:32 233 1
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人