pom配置引入fastdfs <dependency> <groupId>com.github.tobato</groupId> <artifactId>fastdfs-client</artifactId> <version>1.25.2-RELEASE</version> </de...
SpringCloud中配置中心或者启动配置application.properties文件 application.properties配置实例 如下配置文件: spring.datasource.type=com.alibaba.druid.pool.DruidDataSource spring.datasource.url=jdbc:mysql://x.x.x.x:3306/database...
springBoot中Contoller层的注解有如下几种: @RestController @RequestMapping @PostMapping @RequestBody @ResponseBody @PathParam @RequestParam springboot controller 层各注解使用举例 1 pa...
oauth2 定义了下面四种授权方式: 授权码模式(authorization code) 简化模式(implicit) 密码模式(resource owner password credentials) 客户端模式(client credentials) 涉及参数: response_type:表示授权类型,必选项,此处的值固定为"code" client_id:...
基于springboot 实现一个登录拦截器 1.定义一个视图解析器 @Configuration public class MyMvcConfig implements WebMvcConfigurer { /** * 注册拦截器 */ @Override public void addInterceptors(InterceptorRegistry...
使用SpringBoot创建定时任务非常简单,目前主要有以下三种创建方式: 1、基于注解(@Scheduled)2、基于接口(SchedulingConfigurer) 前者相信大家都很熟悉,但是实际使用中我们往往想从数据库中读取指定时间来动态执行定时任务,这时候基于接口的定时任务就派上用场了。3、基于注解设定多线程定时任务 springboot定时任务实现 基于注解 基于注解@Scheduled...
springboot 集成netty pom.xml加依赖包 通常的springboot 的pom文件有springboot-starter-web依赖,这样会为项目添加tomcat容器,端口8080,由于这个项目用netty,不需要tomcat,所以用spring-boot-starter和spring-boot-configuration-processor 1 <project xm...
跨域问题在页面前后端分离的项目中经常会遇到,这里介绍 springboot实现的后端服务逻辑中如何处理跨域问题 创建如下的配置类即可 @Configuration public class CorsConfig { @Bean public CorsWebFilter corsFilter() { CorsConfiguration config = new Cor...
SpringBoot集成RabbitMQ 1.Pom(引入starter) <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> </dependency> ...
springboot的启动类xxxApplication不能扫描到拦截器配置类,可加上@ComponentScan(basePackages={"com.maya.common"}),即可解决。其中com.maya.common 为拦截器的注解配置类所在的路径。 如图: 拦截器代码: 添加拦截器: 如果访问出现404 找不到类型的情况 将@ComponentScan(baseP...