java - 使用配置文件的最佳方法是什么?

标签 java jsp spring-mvc jakarta-ee

.属性? .xml?

在网站中进行配置的最佳方法是什么? 就我而言,我需要一些变量,例如

server_home =“http://site.com”

site_name = "网站名称"

默认语言=“en”

images_folder =“/var/images/...” ...


Spring 支持什么?

最佳答案

最简单的方法是使用“.properties”文件以及 Spring 的 PropertyPlaceHolderConfigurer。查看 javadoc http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.html

关于java - 使用配置文件的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5849938/

相关文章:

java - 从 Libgdx 的表中删除行时出错

java - NullPointerException - Android 谷歌地图街景

java - 为 API 和 Angular 内容设置 spring 主机域作为主域

Java - Switch 语句无法正常运行,System.out.println 神秘地重复

java - JSP找不到资源

javascript - 将div的innerHTML替换为<jsp :inclue>

java - JSP, "User cannot be resolved to a type"

javascript - 当使用 AngularJS 登录后授权 header 不存在时,Spring Security 不会抛出错误

spring - 寻找一个基于 spring 3.x 的轻量级 CMS/博客引擎

java - setJMenuBar 不工作