Package org.springframework.jmx.access

# Class MBeanProxyFactoryBean

java.lang.Object
org.springframework.jmx.access.MBeanClientInterceptor
org.springframework.jmx.access.MBeanProxyFactoryBean

All Implemented Interfaces:
  `org.aopalliance.aop.Advice`, `org.aopalliance.intercept.Interceptor`, `org.aopalliance.intercept.MethodInterceptor`, `org.springframework.beans.factory.Aware`, `org.springframework.beans.factory.BeanClassLoaderAware`, `org.springframework.beans.factory.DisposableBean`, `org.springframework.beans.factory.FactoryBean<Object>`, `org.springframework.beans.factory.InitializingBean`

public class MBeanProxyFactoryBean extends MBeanClientInterceptor implements org.springframework.beans.factory.FactoryBean<Object>, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.InitializingBean
Creates a proxy to a managed resource running either locally or remotely. The "proxyInterface" property defines the interface that the generated proxy is supposed to implement. This interface should define methods and properties that correspond to operations and attributes in the management interface of the resource you wish to proxy.

There is no need for the managed resource to implement the proxy interface, although you may find it convenient to do. It is not required that every operation and attribute in the management interface is matched by a corresponding property or method in the proxy interface.

Attempting to invoke or access any method or property on the proxy interface that does not correspond to the management interface will lead to an `InvalidInvocationException`.

Since:
  1.2
Author:
  Rob Harrop, Juergen Hoeller
See Also:
  - `MBeanClientInterceptor`
  - `InvalidInvocationException`

## Field Summary

### Fields inherited from class org.springframework.jmx.access.MBeanClientInterceptor

`logger`

### Fields inherited from interface org.springframework.beans.factory.FactoryBean

`OBJECT_TYPE_ATTRIBUTE`

## Constructor Summary

Constructors
Constructor
Description
`MBeanProxyFactoryBean()`

## Method Summary

Modifier and Type
Method
Description
`void`
`afterPropertiesSet()`
Checks that the `proxyInterface` has been specified and then generates the proxy for the target MBean.
`Object`
`getObject()`
`Class<?>`
`getObjectType()`
`boolean`
`isSingleton()`
`void`
`setBeanClassLoader(ClassLoader classLoader)`
`void`
`setProxyInterface(Class<?> proxyInterface)`
Set the interface that the generated proxy will implement.

### Methods inherited from class org.springframework.jmx.access.MBeanClientInterceptor

`convertResultValueIfNecessary, destroy, doInvoke, getEnvironment, getManagementInterface, handleConnectFailure, invoke, isPrepared, prepare, setAgentId, setConnectOnStartup, setEnvironment, setManagementInterface, setObjectName, setRefreshOnConnectFailure, setServer, setServiceUrl, setUseStrictCasing`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### MBeanProxyFactoryBean

public MBeanProxyFactoryBean()

## Method Details

### setProxyInterface

public void setProxyInterface(Class<?> proxyInterface)
Set the interface that the generated proxy will implement.

This will usually be a management interface that matches the target MBean, exposing bean property setters and getters for MBean attributes and conventional Java methods for MBean operations.

See Also:
  - `MBeanClientInterceptor.setObjectName(java.lang.Object)`

### setBeanClassLoader

public void setBeanClassLoader(ClassLoader classLoader)

Specified by:
  `setBeanClassLoader` in interface `org.springframework.beans.factory.BeanClassLoaderAware`
Overrides:
  `setBeanClassLoader` in class `MBeanClientInterceptor`

### afterPropertiesSet

public void afterPropertiesSet() throws MBeanServerNotFoundException, MBeanInfoRetrievalException
Checks that the `proxyInterface` has been specified and then generates the proxy for the target MBean.

Specified by:
  `afterPropertiesSet` in interface `org.springframework.beans.factory.InitializingBean`
Overrides:
  `afterPropertiesSet` in class `MBeanClientInterceptor`
Throws:
  `MBeanServerNotFoundException`
  `MBeanInfoRetrievalException`

### getObject

@Nullable public Object getObject()

Specified by:
  `getObject` in interface `org.springframework.beans.factory.FactoryBean<Object>`

### getObjectType

@Nullable public Class<?> getObjectType()

Specified by:
  `getObjectType` in interface `org.springframework.beans.factory.FactoryBean<Object>`

### isSingleton

public boolean isSingleton()

Specified by:
  `isSingleton` in interface `org.springframework.beans.factory.FactoryBean<Object>`