init
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user