spring 加载自定义配置
来源:互联网 发布:龙珠直播软件 编辑:程序博客网 时间:2024/05/17 15:18
package com.lawu.eshop.order.srv.constants;import org.springframework.beans.factory.annotation.Value;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.boot.context.properties.ConfigurationProperties;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.annotation.Configuration;import org.springframework.context.annotation.PropertySource;import org.springframework.stereotype.Component;@Configuration@ComponentScan@EnableAutoConfiguration@ConfigurationProperties(prefix = "order")@PropertySource(value = "classpath:job.properties", ignoreResourceNotFound = true)@Componentpublic class JobConstant {@Value("${order.refund.request.time}")private int refundRequestTime;private int automaticCancelOrder;public int getRefundRequestTime() {return refundRequestTime;}public void setRefundRequestTime(int refundRequestTime) {this.refundRequestTime = refundRequestTime;}public int getAutomaticCancelOrder() {return automaticCancelOrder;}public void setAutomaticCancelOrder(int automaticCancelOrder) {this.automaticCancelOrder = automaticCancelOrder;}}
配置类,自动装配
# order configorder.refund.request.time=7order.automaticCancelOrder=2
配置文件
阅读全文
0 0
- spring 加载自定义配置
- Spring 加载自定义 porperties 文件配置
- spring boot加载自定义配置源
- 自定义加载Spring配置文件
- 一般加载Spring配置
- spring web 加载配置
- spring初始化配置加载
- spring加载配置web
- spring boot 自定义加载tomcat
- spring自定义配置文件的加载
- 自定义Spring配置标签
- Spring Boot-自定义配置
- Spring Boot自定义配置
- Spring 自定义环境配置
- Spring PropertyPlaceholderConfigurer 自定义扩展来解决多环境配置加载的问题
- spring @Value加载配置值
- JUnit 中加载spring 配置
- Spring Boot 资源加载配置
- 第六次C++作业
- Cocos2d-x下Lua调用自定义C++类和函数的最佳实践
- 写给迷茫的程序员
- vlayout源码思路解析
- 和文本框有关的练习(JTextArea和document)
- spring 加载自定义配置
- 02_插入算法
- JAVA设计模式-策略模式应用实例
- 特长生模拟——遭遇战
- 爱测未来开发-InfluxDB使用
- leetcode palindrome-number(判断一个数字是否是回文)
- 共享手机 馅饼还是陷阱
- Http请求中Content-Type讲解以及在Spring MVC中的应用
- 买装备(特长生准备)