当前位置: 首页 > news >正文

b2c网站建设 杭州seo推广经验

b2c网站建设 杭州,seo推广经验,一个网站 多个域名,无锡做装修网站Spring Boot 启动时修改上下文 为了让项目在启东时&#xff0c;加载到封装的JAR中的国际化文件在封装JAR是增加以下配置类可用于更改启动上下文中的信息依赖 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-autoco…

Spring Boot 启动时修改上下文

  • 为了让项目在启东时,加载到封装的JAR中的国际化文件
  • 在封装JAR是增加以下配置类
  • 可用于更改启动上下文中的信息
  • 依赖
        <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-autoconfigure</artifactId><version>2.7.18</version></dependency>
  • 示例
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.Ordered;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MapPropertySource;import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Set;public class EnviromentAutoConfigration implements ApplicationContextInitializer<ConfigurableApplicationContext>, Ordered {@Overridepublic int getOrder() {return Integer.MAX_VALUE;}@Overridepublic void initialize(ConfigurableApplicationContext applicationContext) {ConfigurableEnvironment environment = applicationContext.getEnvironment();HashMap<String, Object> properties = new HashMap<>();properties.put("spring.messages.basename", getMessagesBasenameProperty(environment));MapPropertySource propertySource = new MapPropertySource("", properties);environment.getPropertySources().addFirst(propertySource);}
/*
*读取指定的国际化文件
*/private static String getMessagesBasenameProperty(Environment environment) {LinkedHashSet<Object> basenames = new LinkedHashSet<>();String basenameString = environment.getProperty("spring.messages.basename");if (StringUtils.isNoneBlank(basenameString)) {basenames.addAll(Set.of(basenameString.split(",")));}basenames.add("messages/xxx_messages");return String.join(",",basenames);}
}

resources目录下META-INF文件夹spring.factories文件配置指定类

#上下文,环境配置,这个会先读取
org.springframework.cloud.BootstrapConfiguration=xxx.EnviromentAutoConfigration
#读取@Configuration注解的配置文件
org.springframework.boot.autoconfigure.EnableAutoConfiguration=
http://www.hengruixuexiao.com/news/32993.html

相关文章:

  • 家政服务 技术支持 东莞网站建设百度直播
  • 安徽做网站品牌营销策略分析
  • 陕西网站建设品牌公司推荐baike seotl
  • 网站可分为哪两种类型搭建网站流程
  • 网站开发技术应用领域seo推广优化培训
  • 做设计图任务的网站外贸网站免费推广b2b
  • 代推广app下载宁波百度seo点击软件
  • 接外贸单的平台网站推广与优化平台
  • 无棣县建设局网站网站链接提交
  • 大连市政府信息公开网手机seo百度点击软件
  • 免费做网站支持绑定管理培训
  • 建设网站的申请信用卡分期付款注册推广赚钱一个40元
  • 怎么做网站平台今日新闻大事
  • 东莞英文网站制作如何优化关键词搜索排名
  • 平罗门户网站建设seo教程免费
  • 泰州建设局网站国内seo公司排名
  • b2b2c网站建设梅州网络推广
  • 郑州哪里做网站营销技巧
  • 厦门 微网站制作百度爱采购官方网站
  • 网站app建设方案sem推广代运营
  • 天津网站制作哪家好薇白酒最有效的推广方式
  • 电商网站设计费用百度网址大全 官网首页
  • 城市建设管理seo模拟点击
  • 无锡建设招标网站北京疫情最新新闻
  • 如何建立公司网站意味着什么爱站网长尾关键词挖掘工具下载
  • 丽水网站域名注册服务公司友情链接发布
  • web网站开发用什么高级搜索引擎
  • 免费域名注册网站怎么登录百度发作品入口在哪里
  • 有没有专门做美食的网站西安搜建站科技网站
  • 做网站建设月收入多少网络营销与直播电商专业就业前景