This commit is contained in:
dute7liang
2024-01-01 03:52:14 +08:00
parent 248d0271b1
commit 3aa29bcefc
31 changed files with 407 additions and 92 deletions

View File

@@ -0,0 +1,22 @@
package com.ruoyi.yunxin.config;
import com.dtflys.forest.converter.json.ForestJacksonConverter;
import com.dtflys.forest.converter.json.ForestJsonConverter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ForestConfig {
@Bean
public ForestJsonConverter forestJacksonConverter() {
ForestJacksonConverter converter = new ForestJacksonConverter();
ObjectMapper mapper = converter.getMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
// converter.setDateFormat("yyyy-MM-dd HH:mm:ss");
return converter;
}
}

View File

@@ -0,0 +1,22 @@
package com.ruoyi.yunxin.config;
import com.dtflys.forest.Forest;
import com.dtflys.forest.config.ForestConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@Component
public class ForestInit {
@Autowired
private YunxinProperties yunxinProperties;
@PostConstruct
public void init(){
ForestConfiguration configuration = Forest.config();
configuration.setVariableValue("baseUrl", (method) -> yunxinProperties.getBaseUrl());
}
}

View File

@@ -0,0 +1,16 @@
package com.ruoyi.yunxin.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "yunxin")
public class YunxinProperties {
private String baseUrl = "https://api.netease.im/nimserver";
private String appKey;
private String appSecret;
private String defaultFromUid;
}