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
如何读取配置性文件信息
最新推荐文章于 2022-06-08 09:25:42 发布