springboot13 Hikari 和Introspector

SpringBoot Initializr

Introspector(内省)

class TestReflect {
    @Test
    fun testReflect() {
        //获取字节码对象
        val clazz = Product::class.java
		//创建实体对象
        val product = clazz.newInstance()
		//获取声明的字段
        val fields = clazz.declaredFields
    /*  val writeMethodName = "set${it.name.substring(0, 1).toUpperCase()}${it.name.substring(1)}"
            println(writeMethodName)
            val writeMethod = clazz.getDeclaredMethod(writeMethodName, it.type)
            writeMethod.invoke(product,13)*/

        	//通过Introspector获取javaBean信息
            val beanInfo = Introspector.getBeanInfo(clazz)
        	//通过beanInfo获取到所有的属性描述,遍历获取它们的set方法
            beanInfo.propertyDescriptors.forEach {
                println(it.writeMethod)
            }
    }

Hikari

file and code templates

Setting-----Editor-----Class

常用资讯网站

https://toutiao.io

csdn,简书,小红书,掘金,stackoverflow,androidWeekly,https://segmentfault.com/

原文地址:https://www.cnblogs.com/xiaocongcong888/p/9436316.html