
springboot
伈伈点灯
博客地址:https://alexaccele.github.io/
展开
-
springboot中使用缓存
个人博客地址:http://alexaccele.github.io/1.导入cache模块要在springboot中使用缓存技术首先要导入springboot的缓存模块,在pom文件中添加如下代码,或者在创建工程时选中cache模块,两者是一样的,选中cache模块也会在pom文件中添加如下代码<dependency> <groupId>org.sprin...原创 2018-07-24 17:13:38 · 235 阅读 · 0 评论 -
springboot中使用异步任务
个人博客地址:http://alexaccele.github.io/在springboot中使用简单的异步任务同步情况首先来看一下同步情况下的代码,在service中添加了一个线程等待方法@Servicepublic class AsyncService { public void asyncHello(){ try { Th...原创 2018-07-29 15:47:28 · 552 阅读 · 0 评论 -
springboot中的定时任务
个人博客地址:http://alexaccele.github.io/在springboot中让任务定时执行首先在入口类上添加@EnableScheduling注解@EnableScheduling@SpringBootApplicationpublic class DemoApplication { public static void main(String[] a...原创 2018-07-29 16:16:11 · 655 阅读 · 0 评论 -
springboot整合spring security
个人博客地址:http://alexaccele.github.io/springboot 要想使用spring security的模块需要导入相应的依赖在pom文件中添加一下代码 <dependency> <groupId>org.springframework.boot</groupId> ...原创 2018-07-21 17:15:41 · 532 阅读 · 0 评论 -
Redis实现分布式锁
import org.springframework.beans.factory.annotation.Autowired;import org.springframework.data.redis.core.StringRedisTemplate;import org.springframework.stereotype.Component;import org.springframew...原创 2018-07-30 14:25:10 · 146 阅读 · 0 评论 -
在springboot中使用vsftpd实现文件上传到服务器
个人博客地址:https://alexaccele.github.io/首先在Linux服务器中安装vsftpd组件 yum -y install vsftpd 添加一个ftp用户此用户就是用来登录ftp服务器用的。[root@bogon ~]# useradd ftpuser这样一个用户建完,可以用这个登录,记得用普通登录不要用匿名了。登录后默认的路径为 /home/...原创 2018-08-04 11:35:41 · 2743 阅读 · 0 评论 -
springboot2.0中配置多数据源
个人博客地址:https://alexaccele.github.io/由于在springboot2.0中配置多数据源时遇到了很多问题,也看了许多大牛的博客最终解决了问题,于是在这里记录一下我的解决过程。配置文件中的url应改用jdbc-url在最开始时我配置的是url,结果会出现 jdbcUrl is required with driverClassName的错误下面是正确的...原创 2018-08-08 18:45:48 · 5353 阅读 · 4 评论 -
服务发现——基于Eureka服务器实现微服务注册
在任何分布式架构中,都需要找到机器所在的物理地址,这个过程称为服务发现。服务发现的优点:可以快速对环境中运行的服务实例数量进行水平伸缩将服务的物理位置抽象,由于服务消费者不知道实际服务实例的物理位置,因此可以从可用服务池中添加或移除服务实例有助于提高应用的弹性。当服务实例不可用时,可从内部可用服务列表移除该实例。服务发现架构微服务通过服务发现代理进行注册通过服务发现代理来查找各...原创 2019-06-27 16:41:47 · 607 阅读 · 0 评论