public static <T> void setProperty(Object bean, String name, Class<T> clazz, T value) throws Exception {
        Method method = ReflectUtils.getPropertySetterMethod(bean.getClass(), name, clazz);
        if (method.isAccessible()) {
            method.invoke(bean, value);
        } else {
            try {
                method.setAccessible(true);
                method.invoke(bean, value);
            } finally {
                method.setAccessible(false);
            }
        }
    }
@Test
    public void testSetProperty() throws Exception {
        TestBean config = new TestBean();
        BeanUtils.setProperty(config, "alias", String.class, "1111aaaa");
        Assert.assertEquals(config.getAlias(), "1111aaaa");
        BeanUtils.setProperty(config, "alias", String.class, null);
        Assert.assertNull(config.getAlias());

        BeanUtils.setProperty(config, "heartbeat", int.class, 3000);
        Assert.assertEquals(config.getHeartbeat(), 3000);

        BeanUtils.setProperty(config, "heartbeat", int.class, new Integer(7000));
        Assert.assertEquals(config.getHeartbeat(), 7000);

        boolean error = false;
        try {
            BeanUtils.setProperty(config, "xxx", String.class, "1111aaaa");
        } catch (Exception e) {
            error = true;
        }
        Assert.assertTrue(error);
    }