如何读取配置性文件信息

        try {
//            Properties pro = new Properties();
//            FileInputStream in = null;
//            String springConfigLocation = "/data/code/credit-ws-conf/config.properties";
//            try {
//
//                in = new FileInputStream(springConfigLocation);
//                pro.load(in);
//
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//        String strHost = pro.getProperty("spring.mail.host");
//        String strUsername = pro.getProperty("spring.mail.username");
//        String strPassword = pro.getProperty("spring.mail.password");
 等于:
 ServiceEmail sendEmail = emailService.findSendEmailByStatus(StatusCode.EMAIL_VERIFICATION);
 配置文件:
 # Server HTTP port.
server.port=8080
#dev tools
spring.devtools.livereload.enabled=true
# 静态文件请求匹配方式
spring.mvc.static-path-pattern=/**
# 修改默认的静态寻址资源目录
spring.resources.static-locations = classpath:/templates/,classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
logback.level.admin=INFO
logback.dir.admin=@logback.dir.admin@
server.tomcat.accesslog.directory=@logging.dir.admin@
server.tomcat.accesslog.prefix=access_admin_log
server.tomcat.accesslog.enabled=true
security.require_ssl=false
#thymeleaf
spring.thymeleaf.cache=false
spring.mvc.favicon.enabled=false

spring.aop.auto=true
spring.aop.proxy-target-class=false

spring.jackson.parser.ALLOW_UNQUOTED_FIELD_NAMES=true
#spring.jackson.serialization.indent-output=true
#spring.jackson.parser.ALLOW_SINGLE_QUOTES=true

logback.level.ws=INFO
logback.dir.ws=@logback.dir.ws@


#jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://172.24.133.35:3306/credit?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
#jdbc.username=credit_service
#jdbc.password=credit_service

jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/credit?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false
jdbc.username=root
jdbc.password=

spring.mail.host=smtp.163.com
spring.mail.username=yucongyu@163.com
spring.mail.password=yucong123456
spring.mail.default-encoding=UTF-8

spring.http.multipart.max-file-size=12800KB
spring.http.multipart.max-request-size=1280KB

log.httpRestuest=true

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值