spring-boot
YyCarry
这个作者很懒,什么都没留下…
展开
-
使用切面 获取请求url,请求参数,来源IP
切面类@Slf4j@Aspect@Componentpublic class RequestAspect { @Around("execution(public * com.yex.proxy.controller.ApiController.*(..))") public Object apiAround(ProceedingJoinPoint pPoint) throws Throwable { HttpServletRequest request = Requ原创 2020-07-02 17:31:39 · 6237 阅读 · 2 评论 -
微信支付工具类 小程序 扫码
1.maven导入wxpay-sdk-3.0.9 <dependency> <groupId>com.github.wxpay</groupId> <artifactId>wxpay-sdk</artifactId> <version>3.0.9</version&...原创 2020-04-27 16:43:49 · 698 阅读 · 0 评论 -
解决Spring 在工具类(Utils)无法使用@Autowired注入对象
**如果我们要在我们自己封装的Utils工具类中或者非controller普通类中使用@Autowired注解注入Service或者Mapper接口,直接注入是不可能的,因为Utils使用了静态的方法,我们是无法直接使用非静态接口的,当我们遇到这样的问题,我们就要想办法解决了。 Spring 为啥不能在static变量上注入?**@Component public class TestUt...原创 2018-06-12 11:32:57 · 6082 阅读 · 1 评论 -
SpringBoot上传下载文件
FileController.javaimport org.springframework.stereotype.Controller;import org.springframework.ui.Model;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.b翻译 2017-12-08 10:07:18 · 864 阅读 · 0 评论 -
Springboot集成RabbitMq
RabbitMQ 即一个消息队列,主要是用来实现应用程序的异步和解耦,同时也能起到消息缓冲,消息分发的作用。消息中间件在互联网公司的使用中越来越多,刚才还看到新闻阿里将RocketMQ捐献给了apache,当然了今天的主角还是讲RabbitMQ。消息中间件最主要的作用是解耦,中间件最标准的用法是生产者生产消息传送到队列,消费者从队列中拿取消息并处理,生产者不用关心是谁来消费,消费者不用关心谁在生产消转载 2017-11-25 15:59:12 · 236 阅读 · 0 评论 -
springboot多环境配置
propertiest配置格式在Spring Boot中多环境配置文件名需要满足application-{profile}.properties的格式,其中{profile}对应你的环境标识,比如:application-dev.properties:开发环境 application-test.properties:测试环境 application-prod.properties:生产环境转载 2017-11-25 15:56:23 · 1316 阅读 · 0 评论 -
Spring Boot + Mybatis + Ehcache 二级缓存实例
二级缓存是多个SqlSession共享的,其作用域是mapper的同一个namespace,不同的sqlSession两次执行相同namespace下的sql语句且向sql中传递参数也相同即最终执行相同的sql语句,第一次执行完毕会将数据库中查询的数据写到缓存(内存),第二次会从缓存中获取数据将不再从数据库查询,从而提高查询效率。Mybatis默认没有开启二级缓存需要在setting全局参数中配置开转载 2017-11-25 15:54:15 · 292 阅读 · 0 评论 -
SpringBoot + thymeleaf
1.引入依赖maven中直接引入 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency>1234可以查看依赖关系,发现spring-boot-starter-thyme转载 2017-12-04 19:26:45 · 267 阅读 · 0 评论 -
SpringBoot 定时器(动态定时器)的使用
SpringBoot使用定时器使用方法添加@Scheduled注解 设计cron参数即可package com.clsystem.Comm;import org.springframework.scheduling.annotation.Scheduled;/** * Created by pudding on 2017-11-10.(打卡记录定时任务) */@Componentpublic原创 2017-11-20 19:55:06 · 5040 阅读 · 1 评论 -
SpringBoot 集成 activeMQ
从官方demo开始spring-cloud其他文章: 我们有必要花时间了解spring boot吗? spring boot自动化配置原理 spring-cloud中eureka进行服务治理spring boot提供了对JMS系统的支持,当前,只默认提供了ActiveMQ和ActiveMQ Artemis的自动配置支持。我们一起看下spring boot如何集成ActiveMQ。首先从模仿官转载 2017-12-11 20:11:48 · 1387 阅读 · 0 评论 -
Spring Boot + ActiveMq
下载activeMq:http://activemq.apache.org/activemq-5152-release.html启动activeMq:bin目录下activemq.bat直接启动http://localhost:8161进入activemq首页 pom.xml引入activeMq插件 <!-- activemq --> <dependency>原创 2017-12-11 19:43:45 · 362 阅读 · 0 评论 -
Springboot+RabbitMq
RabbitMQ 即一个消息队列,主要是用来实现应用程序的异步和解耦,同时也能起到消息缓冲,消息分发的作用。消息中间件在互联网公司的使用中越来越多,刚才还看到新闻阿里将RocketMQ捐献给了apache,当然了今天的主角还是讲RabbitMQ。消息中间件最主要的作用是解耦,中间件最标准的用法是生产者生产消息传送到队列,消费者从队列中拿取消息并处理,生产者不用关心是谁来消费,消费者不用关心谁在生产消转载 2017-12-11 18:56:14 · 253 阅读 · 0 评论 -
SpringBoot +Solr
在学习本文章前请先确定solr启动成功!如还没安装solr的朋友请学习此文章http://blog.csdn.net/YyCarry/article/details/78695823pom.xml导入插件solrj<!--solr--><dependency> <groupId>org.apache.solr</groupId> <artifactId>solr-solrj</ar原创 2017-12-02 15:20:28 · 5592 阅读 · 3 评论 -
SpringBoot + Redis
pom.xml集成redis <!--redis--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-redis</artifactId> <version>1.3.5.RELEASE</version>原创 2017-11-16 13:43:27 · 400 阅读 · 0 评论 -
Spring Boot 事务的使用
Spring Boot 使用事务非常简单,首先使用注解 @EnableTransactionManagement 开启事务支持后,然后在访问数据库的Service方法上添加注解 @Transactional 便可。关于事务管理器,不管是JPA还是JDBC等都实现自接口 PlatformTransactionManager 如果你添加的是 spring-boot-starter-jdbc 依赖,框架会转载 2017-11-16 11:29:20 · 314 阅读 · 0 评论 -
Spring boot 服务与配置
Spring Boot 其默认是集成web容器的,启动方式由像普通Java程序一样,main函数入口启动。其内置Tomcat容器或Jetty容器,具体由配置来决定(默认Tomcat)。当然你也可以将项目打包成war包,放到独立的web容器中(Tomcat、weblogic等等),当然在此之前你要对程序入口做简单调整。项目构建我们使用Maven或Gradle,这将使项目依赖、jar包管理、以及打包部署转载 2017-11-16 11:22:20 · 358 阅读 · 0 评论 -
Spring Boot +swagger2
pom.xml导入插件 <!--swagger2--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.6.1</version>原创 2017-11-16 10:28:41 · 195 阅读 · 0 评论 -
SpringBoot + WebSocket
SpringBoot + WebSocketpom.xml导入插件 <!-- SpringWebSocket依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId>原创 2017-11-15 19:24:41 · 325 阅读 · 0 评论