springboot
melody_wkx
这个作者很懒,什么都没留下…
展开
-
springboot详解--外部化配置
Spring Boot程序默认从application.properties或者application.yaml读取配置,如何将配置信息外置,方便配置呢?文章目录1. 通过命令行指定2. 外置配置文件3. 自定义配置文件4. 使用spring cloud config 配置中心5.外部化配置方式与优先级1. 通过命令行指定SpringApplication会默认将命令行选项参数转换为配置信息...原创 2019-05-13 18:58:05 · 410 阅读 · 0 评论 -
spring-boot-redis-starter源码分析
spring-boot-redis-starter源码分析文章目录spring-boot-redis-starter源码分析RedisAutoConfiguration自动配置类,redis链接工厂以及哨兵等监听RedisTemplate执行操作时的链接建立过程commons-pool2池化技术GenericObjectPool.borrowObject()大体思路如下Redis链接释放过程R...原创 2019-05-07 16:58:36 · 944 阅读 · 0 评论 -
springboot详解--常用注解
1. @SpringBootApplication申明让spring boot自动给程序进行必要的配置,等价于以默认属性使用@Configuration、@EnableAutoConfiguration、@ComponentScan2. @RestController返回json字符串的数据,直接可以编写RESTFul的接口3. @ComponentScan告诉Spring 哪个pac...原创 2019-05-12 16:40:17 · 160 阅读 · 0 评论 -
springboot详解--自定义注解
新增注解接口与新建class、interface一样,新建@interface即可。形如下:@Retention(RetentionPolicy.RUNTIME)@Documented@Target(ElementType.TYPE)@Import(MmmAutoConfiguration.class)public @interface EnableMmmClient {}@Re...原创 2019-05-12 17:29:11 · 477 阅读 · 0 评论 -
springboot详解--配置类与自动配置
文章目录xml配置与javaconfig的对比1. 基于表达成面:2. 注册bean定义成面3. 表达依赖注入关系层面javaconfig配置类的几种实现方式自动配置FAQxml配置与javaconfig的对比1. 基于表达成面:基于xml的配置:<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://w...原创 2019-05-13 00:16:49 · 3483 阅读 · 1 评论 -
springboot详解--自定义配置文件
文章目录1.5.x之前的版本1.5.x之前的版本在此之前的版本中,spring-boot的locations属性可以正常使用,即可以使用其指定配置文件的路径。配置类需要与配置文件中的属性相同:我们可以使用如下配置类接收配置文件中的数据。/** * 加载yaml配置文件的方法,生成 * spring-boot更新到1.5.2版本后locations属性无法使用 * @Property...原创 2019-05-13 10:31:50 · 242 阅读 · 0 评论