Is it possible in Spring Boot to autowire object that is marked by @ManagedResource. I'm trying to do that but object is null.
For example:
@Component
@ManagedResource(objectName = MyMBean.MBEAN_NAME)
public class MyMBeanImpl implements MyMBean {
private String attribute;
@Override
@ManagedAttribute(description="some attribute")
public void setAttribute(String attribute) {
this.attribute = attribute;
}
}
Spring creates appropriate MBean. But when I try to autowire this object to use its attribute I'm getting null:
@Component
public final class Consumer {
@Autowired
MyMBean mBean; // is null
...
}