摘要: 当我们在spring boot的configure中disable掉csrf时就避免了以上这种可能性。 当csrf是enable时项目是这样运行的: 从Spring Security 4.0开始,默认情况下会启用CSRF保护,以防止CSRF攻击应用程序,Spring Security CSRF会针对 阅读全文
posted @ 2022-08-02 04:20 小白冲冲 阅读(1489) 评论(0) 推荐(0) 编辑
摘要: // students是一个List,stream()表示循环students中的itemsstudents.stream() // filter表示过滤items中符合条件的,student是当前item,studentId是一个parameter .filter(student -> stude 阅读全文
posted @ 2022-07-24 23:07 小白冲冲 阅读(545) 评论(0) 推荐(0) 编辑
摘要: ALTER TABLE table_name DROP COLUMN column_name 运行时报错 这时我们需要先删除这个依赖 ALTER TABLE table_name DROP CONSTRAINT DF__role__MANAGE_MAC__2B2A60FE 运行完删除依赖指令后我们就 阅读全文
posted @ 2022-07-22 15:50 小白冲冲 阅读(245) 评论(0) 推荐(0) 编辑
摘要: 依赖 <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-security</artifactid> </dependency> 添加依赖后,项目中所有资源都会被保护起来。启 阅读全文
posted @ 2022-07-19 05:47 小白冲冲 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 创建一个Spring Boot 项目时会自动创建一个test文件夹,所有的测试都在其中进行。 依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artif 阅读全文
posted @ 2022-07-19 05:32 小白冲冲 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 在Spring Boot 中,使用Spring Data JPA 和Spring Data Rest 可以快速开发出一个RESTful 应用。 自动将repository转换为rest资源,可不提供controller层接口直接访问数据。 依赖 <dependency> <groupid>org.s 阅读全文
posted @ 2022-07-18 00:01 小白冲冲 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 1. 在Spring Boot Web 工程, 添加MongoDB 依赖 <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-data-mongodb</artifactid 阅读全文
posted @ 2022-07-13 05:22 小白冲冲 阅读(75) 评论(0) 推荐(0) 编辑
摘要: JPA CJava Persistence APD 和Spring Data 是两个范畴的概念。 Hibernate 是一个ORM 框架,而JPA 则是一种ORM 规范。而Hibernate 是这些规范的实现(事实上, 是先有Hibernate 后有JPA, JPA 规范的起草者也是Hibernat 阅读全文
posted @ 2022-07-10 23:46 小白冲冲 阅读(56) 评论(0) 推荐(0) 编辑
摘要: JdbcTemplate 是Spring 提供的一套JDBC模板框架,利用AOP 技术来解决直接使用JDBC 时大量重复代码的问题。JdbcTemplat巳虽然没有MyBatis 那么灵活,但是比直接使用JDBC 要方便很多。Spring Boot 中对JdbcTemplate 的使用提供了自动化配 阅读全文
posted @ 2022-07-10 23:11 小白冲冲 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 有一些特殊的任务需要在系统启动前执行,例如配置文件加载、数据库初始化等操作。如果没有使用Spring Boot,这些问题可以在Listener 中解决。Spring Boot 对此提供了两种解决方案:CommandLineRunner 和ApplicationRunner 。CommandLineR 阅读全文
posted @ 2022-07-08 05:22 小白冲冲 阅读(33) 评论(0) 推荐(0) 编辑