import 对应的 package

import java.util.Properties;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PropertiesLoaderUtils;

//从application.properties文件中获取用到的参数;
Resource resource = new ClassPathResource("application.properties");
Properties props = PropertiesLoaderUtils.loadProperties(resource);
String host = props.getProperty("mail.host");
int port = Integer.parseInt(props.getProperty("mail.port")); 

转载:https://blog.csdn.net/wk1063645973/article/details/98880901

相关文章:

  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2023-03-19
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案