I've got a class like this (from Spring Java Config: how do you create a prototype-scoped @Bean with runtime arguments?)
@Configuration
public class ServiceConfig {
@Bean
public Function<DataObj, MyClass> myClassFactory() {
return data-> myClass(data);
}
@Bean
@Scope(value = "prototype")
public MyClass myClass(DataObj data) {
return new MyClass(data);
}
}
However, IntelliJ (2020.3) complains about DataObj data
- Could not autowire. No beans of 'DataObj' type found
. DataObj is not a bean. It is a runtime object that passes data to the construction of the bean. Even if I leave this IntelliJ error as an error (as opposed to a warning), it still works. Why is IntelliJ complaining about this? Is there a way to suppress the error (without turning off the inspection)?