feat: 增加bean读取器

This commit is contained in:
wangyu 2021-01-05 17:28:52 +08:00
parent 81c27d6856
commit 9bfa1bc3d4

View File

@ -2,6 +2,7 @@ package com.flyfish.framework.beans.meta;
import com.flyfish.framework.bean.Result;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ClassUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -29,7 +30,7 @@ public class BeanController {
@GetMapping("")
public Result<List<BeanProperty>> beanInfo(String className) {
try {
return Result.ok(Arrays.stream(BeanUtils.getPropertyDescriptors(Class.forName(className)))
return Result.ok(Arrays.stream(BeanUtils.getPropertyDescriptors(ClassUtils.getClass(className)))
.map(BeanProperty::form)
.collect(Collectors.toList()));
} catch (ClassNotFoundException e) {