@Test void shouldThrowForStaticPostConstructMethod() { Static classWithStaticMethod = new Static(); InjectorException ex = assertThrows(InjectorException.class, () -> postConstructInvoker.postProcess(classWithStaticMethod, null, null)); assertThat(ex.getMessage(), containsString("@PostConstruct method may not be static or have any parameters")); }
@Override public <T> T postProcess(T object, ResolutionContext context, Resolution<?> resolution) { Class<?> clazz = object.getClass(); List<Method> postConstructMethods = getPostConstructMethods(clazz); for (int i = postConstructMethods.size() - 1; i >= 0; --i) { ReflectionUtils.invokeMethod(postConstructMethods.get(i), object); } return null; }
PostConstructMethodInvoker implements Handler { @Override public <T> T postProcess(T object, ResolutionContext context, Resolution<?> resolution) { Class<?> clazz = object.getClass(); List<Method> postConstructMethods = getPostConstructMethods(clazz); for (int i = postConstructMethods.size() - 1; i >= 0; --i) { ReflectionUtils.invokeMethod(postConstructMethods.get(i), object); } return null; } }
PostConstructMethodInvoker implements Handler { @Override public <T> T postProcess(T object, ResolutionContext context, Resolution<?> resolution) { Class<?> clazz = object.getClass(); List<Method> postConstructMethods = getPostConstructMethods(clazz); for (int i = postConstructMethods.size() - 1; i >= 0; --i) { ReflectionUtils.invokeMethod(postConstructMethods.get(i), object); } return null; }  }
PostConstructMethodInvoker implements Handler { @Override public <T> T postProcess(T object, ResolutionContext context, Resolution<?> resolution) { Class<?> clazz = object.getClass(); List<Method> postConstructMethods = getPostConstructMethods(clazz); for (int i = postConstructMethods.size() - 1; i >= 0; --i) { ReflectionUtils.invokeMethod(postConstructMethods.get(i), object); } return null; }  @Override T postProcess(T object, ResolutionContext context, Resolution<?> resolution); }
PostConstructMethodInvoker implements Handler { @Override public <T> T postProcess(T object, ResolutionContext context, Resolution<?> resolution) { Class<?> clazz = object.getClass(); List<Method> postConstructMethods = getPostConstructMethods(clazz); for (int i = postConstructMethods.size() - 1; i >= 0; --i) { ReflectionUtils.invokeMethod(postConstructMethods.get(i), object); } return null; }  @Override T postProcess(T object, ResolutionContext context, Resolution<?> resolution);  }