对比新文件 |
| | |
| | | package com.vci.ubcs.system.config; |
| | | |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.cloud.context.config.annotation.RefreshScope; |
| | | import org.springframework.core.env.Environment; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | |
| | | /** |
| | | * nacos涓婇厤缃殑瓒呯淇℃伅 |
| | | * @author ludc |
| | | * @date 2023/8/31 13:02 |
| | | */ |
| | | @Component |
| | | @RefreshScope |
| | | public class NacosConfig { |
| | | |
| | | @Autowired |
| | | private Environment environment; |
| | | |
| | | private static final String NACOS_CONFIG_CACHE = "nacos:config"; |
| | | |
| | | private static final String ADMIN_INFO_CODE = "admin:info:"; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | BladeUser adminUser = new BladeUser(); |
| | | adminUser.setTenantId(environment.getProperty("user-info.tenant-id", "000000")); |
| | | adminUser.setUserName(environment.getProperty("user-info.user-name","admin")); |
| | | adminUser.setUserId(Func.toLong(environment.getProperty("user-info.id","0"))); |
| | | CacheUtil.getCache(NACOS_CONFIG_CACHE).put(ADMIN_INFO_CODE,adminUser); |
| | | } |
| | | |
| | | } |