hibernate-mile米乐体育
java学习
2022年04月22日 18:01
0
目录
* comma-separated list of basenames, each following the resourcebundle convention. * essentially a fully-qualified classpath location. if it doesn't contain a package * qualifier (such as "org.mypackage"), it will be resolved from the classpath root. */ private string basename = "messages"; /** * message bundles encoding. */ private charset encoding = charset.forname("utf-8"); /** * loaded resource bundle files cache expiration, in seconds. when set to -1, bundles * are cached forever. */ private int cacheseconds = -1; /** * set whether to fall back to the system locale if no files for a specific locale * have been found. if this is turned off, the only fallback will be the default file * (e.g. "messages.properties" for basename "messages"). */ private boolean fallbacktosystemlocale = true; /** * set whether to always apply the messageformat rules, parsing even messages without * arguments. */ private boolean alwaysusemessageformat = false; @bean public messagesource messagesource() { resourcebundlemessagesource messagesource = new resourcebundlemessagesource(); if (stringutils.hastext(this.basename)) { messagesource.setbasenames(stringutils.commadelimitedlisttostringarray( stringutils.trimallwhitespace(this.basename))); } if (this.encoding != null) { messagesource.setdefaultencoding(this.encoding.name()); } messagesource.setfallbacktosystemlocale(this.fallbacktosystemlocale); messagesource.setcacheseconds(this.cacheseconds); messagesource.setalwaysusemessageformat(this.alwaysusemessageformat); return messagesource; } public string getbasename() { return this.basename; } public void setbasename(string basename) { this.basename = basename; } public charset getencoding() { return this.encoding; } public void setencoding(charset encoding) { this.encoding = encoding; } public int getcacheseconds() { return this.cacheseconds; } public void setcacheseconds(int cacheseconds) { this.cacheseconds = cacheseconds; } public boolean isfallbacktosystemlocale() { return this.fallbacktosystemlocale; } public void setfallbacktosystemlocale(boolean fallbacktosystemlocale) { this.fallbacktosystemlocale = fallbacktosystemlocale; } public boolean isalwaysusemessageformat() { return this.alwaysusemessageformat; } public void setalwaysusemessageformat(boolean alwaysusemessageformat) { this.alwaysusemessageformat = alwaysusemessageformat; } protected static class resourcebundlecondition extends springbootcondition { private static concurrentreferencehashmap从上面的messagesource自动配置可以看出,可以通过spring.message.basename指定要配置国际化文件位置,默认值是“message”。spring boot默认就支持国际化的,默认会去resouces目录下寻找message.properties文件。
这里就不进行过多关于国际化相关信息的介绍了,肯定少不了区域解析www.cppcns.com器。springboot国际化相关知识请参考:spring boot国际化(i18n)
到此这篇关于hibernate-validator如何使用校验框架的文章就介绍到这了,更多相关hibernate-validator校验内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!
展开全文