public class HelloMBean {
public void sayHello() {
System.out.println("hello world");
}
}
in my module, i have:
bind(HelloMBean.class).asEagerSingleton();
and after creating my injector, i have:
Manager.manage("hello", injector);
This exposes my MBean (along with with all my other Guice bindings) in
JConsole but doesn't give me access to the "sayHello" operation. Am I
missing something or am I misunderstanding the purpose of Guice's JMX
support?
On Sep 1, 12:43 am, "Bob Lee" <crazy...@crazybob.org> wrote:
> Guice's JMX support only exposes binding information. You'll have to
> manually register your MBean with the server.
>
> It's easy though. Create a binding for MBeanServer and inject it into your
> object:
>
> public class HelloMBean {
> @Inject
> HelloMBean(MBeanServer server) {
> server.registerMBean(this, ...);
> }
>
> public void sayHello() {
> System.out.println("hello world");
> }
>
> }
>
> Bob
>