1.1.1 对象与JSON转化 @Test public void toJSON() throws IOException{ Jedis jedis = new Jedis("192.168.126.174",6379); User user = new User(); user.setId(100); user.setName("json测试"); user.setAge(100); user.setSex("男"); ObjectMapper
解决方案 通过反射的方式获取类型中的所有属性. 引用命名空间 using System.Reflection; 实体类 public class User { private string id; public string Id { get { return id; } set { id = value; } } private string name; public string Name { get { return name; } set { name = value; } }
参考:https://www.cnblogs.com/2013jiutian/p/7294053.html @RequestMapping("/value1") @Controller public Class A { @RequestMapping("/value2") public String method1() { return "xxx"; } } Annotation classAnnotation = A.class.getAnno