
SpringBoot
SpringBoot学习
Wanidde
本人很懒,什么都没有留下 ^_^
展开
-
SpringBoot小练习——用户登录、员工增删改查
实现了用户的登录和注销,登录进去之后就可以对员工的信息进行增删改查了,使用了拦截器来拦截没有登陆的用户进入其他页面。 项目结构 页面 登录页面: 员工管理页面: 新增员工: 修改员工信息: 数据库信息 用户信息表: CREATE TABLE `user1` ( `id` int(0) NOT NULL AUTO_INCREMENT, `use...原创 2020-04-05 18:39:45 · 4524 阅读 · 8 评论 -
SpringBoot——邮件发送
导入依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> 如果是使用QQ发送邮件,需要先获取一个授权码。首先进...原创 2020-04-01 15:47:57 · 196 阅读 · 0 评论 -
SpringBoot中配置Swagger
撒子是Swagger? 使用swagger可以帮助我们更简单的API接口的开发 API文档与API定义同步更新,可以在线测试API接口(API接口就是controller的requestmapping) Swagger其实就是我们前后端分离时来实现前后端开发的信息及时更新Api的一个框架,是前后端的唯一联系。比如我们后端写了一些controller接口,前端就能通过访问swagger-u...原创 2020-03-31 19:50:51 · 1424 阅读 · 0 评论 -
SpringBoot整合Shiro实现用户的认证授权
Apache Shiro 是一个Java的安全框架,不仅可以在JavaSE中使用,还可以在JavaEE中使用。 Shiro可以完成认证、授权、加密、会话管理、Web集成、缓存等。 下载地址:http://www.apache.org/dyn/closer.cgi/shiro/1.5.2/shiro-root-1.5.2-source-release.zip Aurhenrication:身份...原创 2020-03-30 17:30:07 · 670 阅读 · 0 评论 -
SpringBoot——安全框架SpringSecurity
SpringSecurity是撒子? SpringSecurity是针对Spring项目的安全框架,是身份认证和访问控制(授权)的一个框架。之前我们都是使用拦截器来实现,但是大量的原生代码,太繁琐,所以就有了SpringSecurity。 WebSecurityConfigurerAdapter:自定义sercurity策略 AuthenticationManagerBuilder:自定义认...原创 2020-03-29 11:01:06 · 832 阅读 · 0 评论 -
SpringBoot使用Druid连接池
连接数据库:springboot默认数据库hikari spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/mybatis?useSSL=true&useUnicode=true&characterEncoding...原创 2020-03-27 21:30:16 · 4372 阅读 · 0 评论 -
SpringBoot整合Mybatis
环境 JDK10,maven3.6,MySQL8 项目结构 导入依赖 先导入Mybatis的依赖: <!--mybatis-spring-boot-starter--> <dependency> <groupId>org.mybatis.spring.boot</groupId> ...原创 2020-03-27 16:01:53 · 219 阅读 · 0 评论 -
SpringBoot中使用druid访问http://localhost:8080/druid/login.html时报localhost 将您重定向的次数过多。
SpringBoot中使用druid访问http://localhost:8080/druid/login.html时出现以下界面 ServletRegistrationBean<StatViewServlet> bean = new ServletRegistrationBean<>(new StatViewServlet(),"/druid/*"); 添加上访...原创 2020-03-27 11:04:40 · 6071 阅读 · 5 评论 -
SpringBoot连接数据库报错:Access denied for user 'root'@'localhost' (using password: YES)
springboot项目连接数据库的时候报错,大概意思是被拒绝访问了 妈耶要吐血了,找了一上午,修改了有的说用户名用root可能会报错我把用户名改了,有的说权限不够,我改了访问mysql的权限都没什么用,最后看了一个大佬的博客才知道是因为配置文件格式的问题,如果用properties配置是没有问题的,但是用yml就会报错。 这是我之前的application.yml中数据库的配置,看...原创 2020-03-26 14:34:52 · 5395 阅读 · 18 评论 -
SpringBoot扩展SpringMVC配置
官方文档 @Configuration:可以使用自定义类扩展MVC的功能。 @EnableWebMvc:加上他SpringMVC自动配置全部失效。 自定义一个视图解析器 自定义一个视图解析器需要先实现ViewResolver接口。 自定义的视图解析器MyMvcConfig类: package com.lyr.config; import org.springframewo...原创 2020-03-25 16:39:02 · 520 阅读 · 0 评论 -
SpringBoot——Thymeleaf模板引擎
Thymeleaf是什么? 使用thymeleaf,导入依赖,把html放在templates就可以了。 <!--thymeleaf--> <dependency> <groupId>org.thymeleaf</groupId> <artifactId>thymeleaf-spring5</ar...原创 2020-03-22 12:21:42 · 262 阅读 · 0 评论 -
SpringBoot-配置
给属性赋值 使用yaml给属性赋值 Person实体类: @component (把普通pojo实例化到spring容器中,相当于配置文件中的<bean id="" class=""/>) @ConfigurationProperties(prefix = "person") 告诉SpringBoot将本类中的属性和配置文件中相关的配置进行绑定 package com.l...原创 2020-03-19 15:33:58 · 195 阅读 · 0 评论 -
SpringBoot中的自动装配
springboot在启动的时候,从类路径下/META-INF/spring.factories获取指定的值; 将这些自动配置的类导入容器,自动配置就会生效,帮我们进行自动配置; 容器也会存在很多xxxAutoConfiguration的文件(@Bean),就是这些类给容器中导入了导入了这个场景需要的所有组件,并自动装配。 结论:springboot所有自动配置都是在启动的时候扫描并加载:...原创 2020-03-18 17:23:14 · 744 阅读 · 0 评论 -
创建第一个SpringBoot项目——HelloSpringBoot
New->Project->Spring Initializr,选用默认的创建方式 设置项目的坐标 选择web项目 设置项目名称和路径然后Finish就好了。 HellospringbootApplication是程序的入口,application.properties是配置文件,HellospringbootApplicationTests是测试类 ...原创 2020-03-18 11:32:19 · 516 阅读 · 0 评论