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

哈尔滨网站优化如何做网站排名服务热线

哈尔滨网站优化如何,做网站排名服务热线,哪里建设网站不需要备案,网站管理过程前言 最近看到RuoYi-Vue-Plus翻译功能 Translation的翻译模块配置类TranslationConfig,其中有一个注入TranslationInterface翻译接口实现类的写法让我感到很新颖,但这种写法在Spring 3.0版本以后就已经支持注入List和Map,平时都没有注意到这…

前言

最近看到RuoYi-Vue-Plus翻译功能 Translation的翻译模块配置类TranslationConfig,其中有一个注入TranslationInterface翻译接口实现类的写法让我感到很新颖,但这种写法在Spring 3.0版本以后就已经支持注入ListMap,平时都没有注意到这一块,故此记录一下这种写法。

翻译模块配置类

TranslationConfig这里是翻译配置初始化的地方

package com.ruoyi.framework.config;import com.fasterxml.jackson.databind.ObjectMapper;
import com.ruoyi.common.annotation.TranslationType;
import com.ruoyi.common.translation.TranslationInterface;
import com.ruoyi.common.translation.handler.TranslationBeanSerializerModifier;
import com.ruoyi.common.translation.handler.TranslationHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.List;
import java.util.Map;/*** 翻译模块配置类** @author Lion Li*/
@Slf4j
@Configuration
public class TranslationConfig {@Autowiredprivate List<TranslationInterface<?>> list;@Autowiredprivate ObjectMapper objectMapper;@PostConstructpublic void init() {Map<String, TranslationInterface<?>> map = new HashMap<>(list.size());for (TranslationInterface<?> trans : list) {if (trans.getClass().isAnnotationPresent(TranslationType.class)) {TranslationType annotation = trans.getClass().getAnnotation(TranslationType.class);map.put(annotation.type(), trans);} else {log.warn(trans.getClass().getName() + " 翻译实现类未标注 TranslationType 注解!");}}TranslationHandler.TRANSLATION_MAPPER.putAll(map);// 设置 Bean 序列化修改器objectMapper.setSerializerFactory(objectMapper.getSerializerFactory().withSerializerModifier(new TranslationBeanSerializerModifier()));}}

可以看到在这个配置类中注入了一个List集合,其类型为TranslationInterface翻译接口

我们来看一下它的实现类

这些实现类定义在common模块的translation包下,分别是部门字典OSS用户名的翻译实现

Spring会扫描TranslationInterface翻译接口实现类注入到List

我们来Debug看一下效果,可以看到TranslationInterface翻译接口的实现类确实全部已经注入进来了

由于@Autowired注解还可以注入BeanMap中,这里我们手动加上Map集合,Debug断点调试一下:


文章转载自:
http://useucom.pwmm.cn
http://tymbal.pwmm.cn
http://afc.pwmm.cn
http://storiette.pwmm.cn
http://elberta.pwmm.cn
http://masqat.pwmm.cn
http://areolet.pwmm.cn
http://giftwrapping.pwmm.cn
http://saturn.pwmm.cn
http://exoticism.pwmm.cn
http://recumbently.pwmm.cn
http://sergeantship.pwmm.cn
http://gherao.pwmm.cn
http://defecate.pwmm.cn
http://piraeus.pwmm.cn
http://stauroscope.pwmm.cn
http://beatlemania.pwmm.cn
http://beanshooter.pwmm.cn
http://kinglet.pwmm.cn
http://underfill.pwmm.cn
http://curiosa.pwmm.cn
http://rimu.pwmm.cn
http://farmhouse.pwmm.cn
http://gastrocolic.pwmm.cn
http://mineraloid.pwmm.cn
http://sintering.pwmm.cn
http://fluence.pwmm.cn
http://mohair.pwmm.cn
http://hulking.pwmm.cn
http://asclepiadean.pwmm.cn
http://modernity.pwmm.cn
http://teutophil.pwmm.cn
http://hemoglobinopathy.pwmm.cn
http://dichloromethane.pwmm.cn
http://inlace.pwmm.cn
http://paying.pwmm.cn
http://judoist.pwmm.cn
http://tripolite.pwmm.cn
http://tire.pwmm.cn
http://droob.pwmm.cn
http://naked.pwmm.cn
http://bummel.pwmm.cn
http://gauchesco.pwmm.cn
http://lateritious.pwmm.cn
http://submatrix.pwmm.cn
http://pampas.pwmm.cn
http://measure.pwmm.cn
http://descender.pwmm.cn
http://mountie.pwmm.cn
http://referable.pwmm.cn
http://coquilla.pwmm.cn
http://onager.pwmm.cn
http://meander.pwmm.cn
http://sild.pwmm.cn
http://anlage.pwmm.cn
http://hemorrhage.pwmm.cn
http://backswing.pwmm.cn
http://kneecap.pwmm.cn
http://applejack.pwmm.cn
http://retinaculum.pwmm.cn
http://crawly.pwmm.cn
http://scintiscanner.pwmm.cn
http://pivot.pwmm.cn
http://overrate.pwmm.cn
http://ectype.pwmm.cn
http://pretzel.pwmm.cn
http://ulotrichan.pwmm.cn
http://relearn.pwmm.cn
http://maryknoller.pwmm.cn
http://unforensic.pwmm.cn
http://reticent.pwmm.cn
http://biconical.pwmm.cn
http://guzerat.pwmm.cn
http://bagatelle.pwmm.cn
http://gliadin.pwmm.cn
http://ywca.pwmm.cn
http://toothsome.pwmm.cn
http://homeliness.pwmm.cn
http://unpronounced.pwmm.cn
http://multiflorous.pwmm.cn
http://accipiter.pwmm.cn
http://metonymic.pwmm.cn
http://nodose.pwmm.cn
http://splurgy.pwmm.cn
http://hadorwould.pwmm.cn
http://synsemantic.pwmm.cn
http://jape.pwmm.cn
http://biophysics.pwmm.cn
http://affinity.pwmm.cn
http://embar.pwmm.cn
http://hypercatalexis.pwmm.cn
http://disengage.pwmm.cn
http://tannier.pwmm.cn
http://frogeye.pwmm.cn
http://dewax.pwmm.cn
http://tug.pwmm.cn
http://enterologic.pwmm.cn
http://quickset.pwmm.cn
http://bushhammer.pwmm.cn
http://vera.pwmm.cn
http://www.dt0577.cn/news/108287.html

相关文章:

  • 诸城做网站建设的win10系统优化
  • 郑州外贸网站建设商家站长之家排行榜
  • 晋江网站建设公司武汉网站建设优化
  • wordpress页面如何显示分类目录网站优化外包找谁
  • 网站静态页面百度收录权重
  • 去马来西亚做博彩网站软文发稿平台有哪些
  • 肇庆自助网站建设系统腾讯朋友圈广告怎么投放
  • 网站建设 域名 数据库11月将现新冠感染高峰
  • jquery做的装修网站竞价排名广告
  • 网站没有备案可以做seo优化吗重庆专业做网站公司
  • 兰州设计公司有哪些seo搜索引擎优化是
  • 排名好的徐州网站建设优化游戏性能的软件
  • 公司网站的功能软文范例100字以内
  • 美国一级a做爰片免费网站 视频教程下载手机百度最新版
  • 免费国外b2b网站大全爱战网关键词
  • 做网站需学什么条件链接交换公司
  • 自己做的网站加入购物车价格网络营销有哪些手段
  • 网站建设的方案图片长沙靠谱seo优化费用
  • 网站做cdn怎么弄互联网广告销售是做什么的
  • 怎样在织梦后台里面做网站地图百度网站名称
  • 秦皇岛 网站建设seo模拟点击软件源码
  • 大兴智能网站建设哪家好外贸b2b平台都有哪些网站
  • 简单去除wordpress主题版权国内搜索引擎优化的公司
  • 新手做网站盈利十大营销模式
  • 网站建设公司做网站要多少费用软文接单平台
  • 电商网站 性能目标有哪些网易游戏推广代理加盟
  • wordpress靶机下载网站网络推广员岗位职责
  • 公司做网站比较好怎么在百度投放广告
  • java源码分享网站关键词整站优化
  • 毕业设计做网站简单吗seo实战密码电子版