退出登录或注销关键代码
摘要:/** * 注销用户 */ @Override public String logout(HttpServletRequest request, HttpServletResponse response) { //获得用户认证信息 Authentication authentication = Se
阅读全文
获取当前用户权限和用户名关键代码
摘要:/** * 获得当前用户权限 */ private String getAuthorities() { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); List<Strin
阅读全文
实现用户注册关键代码
摘要:/** * 实现注册 */ @Override public String register(MyUser userDomain) { String username = userDomain.getUsername(); List<Authority> authorityList = new Ar
阅读全文
配置安装MongoDB
摘要:https://www.cnblogs.com/zhoulifeng/p/9429597.html
阅读全文
解决:Unable to open JDBC Connection for DDL execution
摘要:1、application.properties中配置错误 需要在 spring.datasource.url 属性中加上 &serverTimezone=Asia/Shanghai&useSSL=false
阅读全文
使用@ControllerAdvice进行全局异常处理关键代码
摘要:package com.tszr.controller; import com.tszr.exception.MyException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.spring
阅读全文
自定义Starters
摘要:<?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:sc
阅读全文
解决:No active profile set, falling back to default profiles: default
摘要:pom.xml加上下面依赖: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
阅读全文
@Conditional根据满足某特定条件创建特定的Bean
摘要:package com.tszr.conditional; import org.springframework.context.annotation.Condition; import org.springframework.context.annotation.ConditionContext;
阅读全文
配置和输出日志
摘要:#设定日志的默认级别为info logging.level.root=info #设定org包下的日志级别为warn logging.level.org=warn #设定com.ch.ch4_1包下的日志级别为debug logging.level.com.ch.ch4_1=debug loggin
阅读全文
使用@PropertySource和@Value读取其它自定义的参数文件里面的参数值
摘要:package com.tszr.controller; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource;
阅读全文
使用@ConfigurationProperties读取application.properties参数
摘要:package com.tszr.model; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @
阅读全文
@RequestMapping 转发数据乱码解决方案
摘要:@RequestMapping(value = "XXXX", method = RequestMethod.GET, produces = "text/html;charset=UTF-8") 添加produce部分
阅读全文
使用@Value给属性参数赋值
摘要:package com.tszr.controller; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.RequestMapping;
阅读全文
使用Environment直接读取application.properties参数
摘要:package com.tszr.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import or
阅读全文
Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean
摘要:在Spring Boot项目中,出现这个错误有两种情况: 一,在main方法所在的类忘记添加@SpringBootApplication 二,缺少依赖,添加即可 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>
阅读全文
配置路由
摘要:<template> <div class="notFound"> <h2>抱歉,您访问的页面<em>失联</em>啦 ...</h2> </div> </template> <script> export default { name: 'NotFound' } </script> import
阅读全文
Idea中创建maven项目
摘要:https://blog.csdn.net/zzvar/article/details/114879815
阅读全文
IntelliJ IDEA 绿色破解版 打开即用
摘要:http://www.javatiku.cn/idea/822.html
阅读全文