package cn.stylefeng.roses.kernel.im.starter;
|
|
import cn.stylefeng.roses.kernel.im.api.ImServerApi;
|
import cn.stylefeng.roses.kernel.im.api.expander.ImConfigExpander;
|
import cn.stylefeng.roses.kernel.im.api.pojo.RongCloudProperties;
|
import cn.stylefeng.roses.kernel.im.rongcloud.RongCloudImServer;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Configuration;
|
|
/**
|
* IM的自动配置类
|
*/
|
@Configuration
|
public class GunsImAutoConfiguration {
|
|
/**
|
* IM发送器的配置
|
*/
|
@Bean
|
@ConditionalOnMissingBean(ImServerApi.class)
|
public ImServerApi imServerApi() {
|
// 融云环境配置
|
RongCloudProperties rongCloudProperties = new RongCloudProperties();
|
|
// 配置默认从系统配置表读取
|
rongCloudProperties.setAppKey(ImConfigExpander.getRongCouldAppKey());
|
rongCloudProperties.setAppSecret(ImConfigExpander.getRongCouldAppSecret());
|
|
return new RongCloudImServer(rongCloudProperties);
|
}
|
|
}
|