ContainerUtils { public static void invokeField(Field field, Object targetBean, Object newValue) { Class<?> toType = field.getType(); newValue = ConverterUtils.convert(toType, newValue); try { field.set(targetBean, newValue); } catch (IllegalAccessException e) { try { field.setAccessible(true); field.set(targetBean, newValue); } catch (IllegalAccessException e1) { logger.error(e1.getMessage(), e); } } catch (IllegalArgumentException e) { throw e; } }  static Method findInitMethod(Class<?> targetBeanType, BindInfo<?> bindInfo); static Method findDestroyMethod(Class<?> targetBeanType, BindInfo<?> bindInfo); static Class<T> findImplClass(final Class<?> notSureType); static Annotation findInject(boolean injectDefault, Annotation[] annotations); static boolean isInjectConstructor(Constructor<?> constructor); static Object injSettings(AppContext appContext, InjectSettings injectSettings, Class<?> toType); static void invokeMethod(Object targetBean, Method initMethod); static void invokeField(Field field, Object targetBean, Object newValue); static boolean testAopIgnore(Class<T> targetType, ClassLoader rootLoader);  }
@Test public void testInject8() throws NoSuchFieldException, IllegalAccessException { PropertyBean initBean = new PropertyBean(); Field field = PropertyBean.class.getDeclaredField("intValue"); ContainerUtils.invokeField(field, initBean, "123"); assert Integer.valueOf(123).equals(field.get(initBean)); }