fix
This commit is contained in:
@@ -4,7 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface IModuleFactory {
|
public interface IModuleFactory {
|
||||||
|
|
||||||
void register(Object object, Class<?> factoryClass, String name, String description);
|
void register(Object object, Class<?> factoryClass, String name);
|
||||||
|
|
||||||
<T> T get(Class<T> factoryClass, String name) throws Throwable;
|
<T> T get(Class<T> factoryClass, String name) throws Throwable;
|
||||||
|
|
||||||
@@ -18,10 +18,10 @@ public interface IModuleFactory {
|
|||||||
|
|
||||||
FactoryInfo getFactoryInfo(Class<?> factoryClass, String name) throws Throwable;
|
FactoryInfo getFactoryInfo(Class<?> factoryClass, String name) throws Throwable;
|
||||||
|
|
||||||
|
@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"})
|
||||||
class FactoryInfo {
|
class FactoryInfo {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
|
||||||
private Class<?> factoryClass;
|
private Class<?> factoryClass;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@@ -32,14 +32,6 @@ public interface IModuleFactory {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class<?> getFactoryClass() {
|
public Class<?> getFactoryClass() {
|
||||||
return factoryClass;
|
return factoryClass;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,4 @@ public @interface FactoryMapping {
|
|||||||
/* 支持环境 */
|
/* 支持环境 */
|
||||||
String[] actives() default {};
|
String[] actives() default {};
|
||||||
|
|
||||||
/* 说明信息 */
|
|
||||||
String description() default "";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class ModuleFactoryImpl implements IModuleFactory {
|
|||||||
|
|
||||||
public void autoRegisterFactory(Class<?> factoryClass) {
|
public void autoRegisterFactory(Class<?> factoryClass) {
|
||||||
List<Class<?>> classList = RunnerApplication.getClassList();
|
List<Class<?>> classList = RunnerApplication.getClassList();
|
||||||
if (classList != null && classList.size() > 0) {
|
if (classList != null && !classList.isEmpty()) {
|
||||||
for (Class<?> clazz : classList) {
|
for (Class<?> clazz : classList) {
|
||||||
FactoryMapping factoryMapping = clazz.getAnnotation(FactoryMapping.class);
|
FactoryMapping factoryMapping = clazz.getAnnotation(FactoryMapping.class);
|
||||||
if (factoryMapping != null) {
|
if (factoryMapping != null) {
|
||||||
@@ -31,8 +31,7 @@ public class ModuleFactoryImpl implements IModuleFactory {
|
|||||||
if ((actives.length == 0 || ArrayUtil.in(actives, currentActive))
|
if ((actives.length == 0 || ArrayUtil.in(actives, currentActive))
|
||||||
&& factoryClass.isAssignableFrom(clazz)) {
|
&& factoryClass.isAssignableFrom(clazz)) {
|
||||||
Object object = RunnerContext.getBean(clazz);
|
Object object = RunnerContext.getBean(clazz);
|
||||||
register(object, factoryClass, factoryMapping.name(),
|
register(object, factoryClass, factoryMapping.name());
|
||||||
factoryMapping.description());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,12 +39,11 @@ public class ModuleFactoryImpl implements IModuleFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(Object object, Class<?> factoryClass, String name, String description) {
|
public void register(Object object, Class<?> factoryClass, String name) {
|
||||||
String factoryName = factoryClass.getName();
|
String factoryName = factoryClass.getName();
|
||||||
// info
|
// info
|
||||||
FactoryInfo factoryInfo = new FactoryInfo();
|
FactoryInfo factoryInfo = new FactoryInfo();
|
||||||
factoryInfo.setName(name);
|
factoryInfo.setName(name);
|
||||||
factoryInfo.setDescription(description);
|
|
||||||
factoryInfo.setFactoryClass(factoryClass);
|
factoryInfo.setFactoryClass(factoryClass);
|
||||||
if (mInfo.containsKey(factoryName)) {
|
if (mInfo.containsKey(factoryName)) {
|
||||||
mInfo.get(factoryName).put(name, factoryInfo);
|
mInfo.get(factoryName).put(name, factoryInfo);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.iqudoo.platform.application.setting.SystemGlobalFileUploadConfig;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@SuppressWarnings({"DuplicatedCode", "SpellCheckingInspection"})
|
@SuppressWarnings({"DuplicatedCode", "SpellCheckingInspection"})
|
||||||
@FactoryMapping(name = "ali-oss", description = "阿里云OSS文件上传")
|
@FactoryMapping(name = "ali-oss")
|
||||||
public class FileUploadAliossProviderImpl implements IFileUploadProvider {
|
public class FileUploadAliossProviderImpl implements IFileUploadProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import javax.annotation.Resource;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@SuppressWarnings({"DuplicatedCode"})
|
@SuppressWarnings({"DuplicatedCode"})
|
||||||
@FactoryMapping(name = "local", description = "本地文件上传")
|
@FactoryMapping(name = "local")
|
||||||
public class FileUploadLocalProviderImpl implements IFileUploadProvider {
|
public class FileUploadLocalProviderImpl implements IFileUploadProvider {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import com.iqudoo.platform.application.facade.repository.ISystemAdminInfoReposit
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@FactoryMapping(name = BizConstants.AUTH_GROUP_SYS_ADMIN, description = "系统管理员")
|
@FactoryMapping(name = BizConstants.AUTH_GROUP_SYS_ADMIN)
|
||||||
public class PermissionSystemAdminProviderImpl implements IPermissionProvider {
|
public class PermissionSystemAdminProviderImpl implements IPermissionProvider {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
|||||||
Reference in New Issue
Block a user