feat: 增加bean读取器
This commit is contained in:
parent
81c27d6856
commit
9bfa1bc3d4
@ -2,6 +2,7 @@ package com.flyfish.framework.beans.meta;
|
|||||||
|
|
||||||
import com.flyfish.framework.bean.Result;
|
import com.flyfish.framework.bean.Result;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.ClassUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -29,7 +30,7 @@ public class BeanController {
|
|||||||
@GetMapping("")
|
@GetMapping("")
|
||||||
public Result<List<BeanProperty>> beanInfo(String className) {
|
public Result<List<BeanProperty>> beanInfo(String className) {
|
||||||
try {
|
try {
|
||||||
return Result.ok(Arrays.stream(BeanUtils.getPropertyDescriptors(Class.forName(className)))
|
return Result.ok(Arrays.stream(BeanUtils.getPropertyDescriptors(ClassUtils.getClass(className)))
|
||||||
.map(BeanProperty::form)
|
.map(BeanProperty::form)
|
||||||
.collect(Collectors.toList()));
|
.collect(Collectors.toList()));
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user