mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
项目结构调整 x 4
This commit is contained in:
parent
90e4966420
commit
e35dde1207
@ -16,14 +16,62 @@
|
||||
|
||||
<properties>
|
||||
<revision>1.0.0</revision>
|
||||
<spring.boot.version>2.4.4</spring.boot.version>
|
||||
</properties>
|
||||
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- 统一依赖管理 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-framework</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>2.4.4</version> <!-- TODO bom 调整 -->
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>asm</artifactId>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId> <!-- 单元测试,我们采用 H2 作为数据库 -->
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>test</scope> <!-- TODO bom 调整 -->
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.fppt</groupId> <!-- 单元测试,我们采用内嵌的 Redis 数据库 -->
|
||||
<artifactId>jedis-mock</artifactId>
|
||||
<version>0.1.16</version> <!-- TODO bom 调整 -->
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>uk.co.jemos.podam</groupId> <!-- 单元测试,随机生成 POJO 类 -->
|
||||
<artifactId>podam</artifactId>
|
||||
<version>7.2.6.RELEASE</version> <!-- TODO bom 调整 -->
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- TODO 稍后清理掉 -->
|
||||
|
@ -250,7 +250,7 @@ public class SysDictDataServiceImpl implements SysDictDataService {
|
||||
|
||||
@Override
|
||||
public List<DictDataRespDTO> listDictDatasFromCache(String type) {
|
||||
return SysDictDataConvert.INSTANCE.convertList03(labelDictDataCache.row(type).values()));
|
||||
return SysDictDataConvert.INSTANCE.convertList03(labelDictDataCache.row(type).values());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ apollo:
|
||||
eagerLoad:
|
||||
enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置
|
||||
jdbc: # 自定义的 JDBC 配置项,用于数据库的地址
|
||||
dao: cn.iocoder.dashboard.modules.infra.dal.mysql.config.InfConfigDAOImpl
|
||||
url: ${spring.datasource.dynamic.datasource.master.url}
|
||||
username: ${spring.datasource.dynamic.datasource.master.username}
|
||||
password: ${spring.datasource.dynamic.datasource.master.password}
|
||||
|
@ -99,6 +99,7 @@ apollo:
|
||||
eagerLoad:
|
||||
enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置
|
||||
jdbc: # 自定义的 JDBC 配置项,用于数据库的地址
|
||||
dao: cn.iocoder.dashboard.modules.infra.dal.mysql.config.InfConfigDAOImpl
|
||||
url: ${spring.datasource.dynamic.datasource.master.url}
|
||||
username: ${spring.datasource.dynamic.datasource.master.username}
|
||||
password: ${spring.datasource.dynamic.datasource.master.password}
|
||||
|
@ -66,7 +66,7 @@ public class SysAuthServiceImplTest extends BaseDbUnitTest {
|
||||
// 准备参数
|
||||
String username = randomString();
|
||||
// mock 方法
|
||||
SysUserDO user = randomUserDO(o -> o.setUsername(username));
|
||||
SysUserDO user = randomPojo(SysUserDO.class, o -> o.setUsername(username));
|
||||
when(userService.getUserByUsername(eq(username))).thenReturn(user);
|
||||
|
||||
// 调用
|
||||
@ -93,7 +93,7 @@ public class SysAuthServiceImplTest extends BaseDbUnitTest {
|
||||
// 准备参数
|
||||
Long userId = randomLongId();
|
||||
// mock 方法 01
|
||||
SysUserDO user = randomUserDO(o -> o.setId(userId));
|
||||
SysUserDO user = randomPojo(SysUserDO.class, o -> o.setId(userId));
|
||||
when(userService.getUser(eq(userId))).thenReturn(user);
|
||||
// mock 方法 02
|
||||
Set<Long> roleIds = randomSet(Long.class);
|
||||
|
@ -1,9 +1,13 @@
|
||||
package cn.iocoder.dashboard.framework.apollo.internals;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ClassUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.iocoder.dashboard.framework.apollo.core.ConfigConsts;
|
||||
import cn.iocoder.dashboard.framework.apollo.internals.dto.ConfigRespDTO;
|
||||
import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.dashboard.util.object.ObjectUtils;
|
||||
import com.ctrip.framework.apollo.Apollo;
|
||||
import com.ctrip.framework.apollo.build.ApolloInjector;
|
||||
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
|
||||
@ -13,8 +17,10 @@ import com.ctrip.framework.apollo.internals.ConfigRepository;
|
||||
import com.ctrip.framework.apollo.tracer.Tracer;
|
||||
import com.ctrip.framework.apollo.util.ConfigUtil;
|
||||
import com.ctrip.framework.apollo.util.factory.PropertiesFactory;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -58,9 +64,7 @@ public class DBConfigRepository extends AbstractConfigRepository {
|
||||
this.propertiesFactory = ApolloInjector.getInstance(PropertiesFactory.class);
|
||||
this.m_configUtil = ApolloInjector.getInstance(ConfigUtil.class);
|
||||
// 初始化 DB
|
||||
cn.iocoder.dashboard.modules.infra.dal.mysql.config
|
||||
this.configFrameworkDAO = new InfConfigDAOImpl(System.getProperty(ConfigConsts.APOLLO_JDBC_URL),
|
||||
System.getProperty(ConfigConsts.APOLLO_JDBC_USERNAME), System.getProperty(ConfigConsts.APOLLO_JDBC_PASSWORD));
|
||||
this.configFrameworkDAO = createConfigFrameworkDAO();
|
||||
|
||||
// 初始化加载
|
||||
this.trySync();
|
||||
@ -71,6 +75,18 @@ public class DBConfigRepository extends AbstractConfigRepository {
|
||||
INSTANCE = this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
private static ConfigFrameworkDAO createConfigFrameworkDAO() {
|
||||
String dao = System.getProperty(ConfigConsts.APOLLO_JDBC_DAO);
|
||||
String url = System.getProperty(ConfigConsts.APOLLO_JDBC_URL);
|
||||
String username = System.getProperty(ConfigConsts.APOLLO_JDBC_USERNAME);
|
||||
String password = System.getProperty(ConfigConsts.APOLLO_JDBC_PASSWORD);
|
||||
// 创建 DBConfigRepository 对象
|
||||
Class<? extends ConfigFrameworkDAO> clazz = ClassUtil.loadClass(dao);
|
||||
Constructor<? extends ConfigFrameworkDAO> constructor = ReflectUtil.getConstructor(clazz, String.class, String.class, String.class);
|
||||
return constructor.newInstance(url, username, password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知同步,
|
||||
*/
|
||||
|
@ -23,8 +23,8 @@ public class ApolloApplicationContextInitializer implements EnvironmentPostProce
|
||||
|
||||
private int order = DEFAULT_ORDER;
|
||||
|
||||
private static final String[] APOLLO_SYSTEM_PROPERTIES = {ConfigConsts.APOLLO_JDBC_URL,
|
||||
ConfigConsts.APOLLO_JDBC_USERNAME, ConfigConsts.APOLLO_JDBC_PASSWORD};
|
||||
private static final String[] APOLLO_SYSTEM_PROPERTIES = {ConfigConsts.APOLLO_JDBC_DAO,
|
||||
ConfigConsts.APOLLO_JDBC_URL, ConfigConsts.APOLLO_JDBC_USERNAME, ConfigConsts.APOLLO_JDBC_PASSWORD};
|
||||
|
||||
@Override
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
|
||||
|
Loading…
Reference in New Issue
Block a user