| | |
| | | package com.ruoyi.common.translation.config; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ruoyi.common.translation.annotation.TranslationType; |
| | | import com.ruoyi.common.translation.core.TranslationInterface; |
| | | import com.ruoyi.common.translation.core.handler.TranslationBeanSerializerModifier; |
| | | import com.ruoyi.common.translation.core.handler.TranslationHandler; |
| | | import jakarta.annotation.PostConstruct; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Autowired |
| | | private List<TranslationInterface> list; |
| | | |
| | | @Autowired |
| | | private ObjectMapper objectMapper; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | Map<String, TranslationInterface> map = new HashMap<>(list.size()); |
| | |
| | | } |
| | | } |
| | | TranslationHandler.TRANSLATION_MAPPER.putAll(map); |
| | | // 设置 Bean 序列化修改器 |
| | | objectMapper.setSerializerFactory( |
| | | objectMapper.getSerializerFactory() |
| | | .withSerializerModifier(new TranslationBeanSerializerModifier())); |
| | | } |
| | | |
| | | } |