Inspectopedia Help

Unknown init/destroy method in the @Bean annotation

Reports unresolved method references on initMethod and destroyMethod parameters of the @Bean annotation.


"Cannot resolve method" will be reported on 'doInit' expression if MyBean class doesn't contain 'public void 'doInit'(){...}' method

public class MyBean {...} @Component public class MyComponent { @Bean(initMethod="doInit" ) public MyBean myBean() {...} }

In this example, the inspection will report an unresolved method reference if MyBean doesn't define the doInit() method.

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Spring, 233.SNAPSHOT

Last modified: 13 July 2023