类 KeyNamingStrategy
- java.lang.Object
- org.springframework.jmx.export.naming.KeyNamingStrategy
- 所有已实现的接口:
InitializingBean
,ObjectNamingStrategy
public class KeyNamingStrategy extends Object implements ObjectNamingStrategy, InitializingBean
ObjectNamingStrategy
implementation that buildsObjectName
instances from the key used in the "beans" map passed toMBeanExporter
.Can also check object name mappings, given as
Properties
or asmappingLocations
of properties files. The key used to look up is the key used inMBeanExporter
's "beans" map. If no mapping is found for a given key, the key itself is used to build anObjectName
.
构造器概要
构造器 构造器 说明 KeyNamingStrategy()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Merges theProperties
configured in themappings
andmappingLocations
into the finalProperties
instance used forObjectName
resolution.ObjectName
getObjectName(Object managedBean, String beanKey)
Attempts to retrieve theObjectName
via the given key, trying to find a mapped value in the mappings first.void
setMappingLocation(Resource location)
Set a location of a properties file to be loaded, containing object name mappings.void
setMappingLocations(Resource... mappingLocations)
Set location of properties files to be loaded, containing object name mappings.void
setMappings(Properties mappings)
Set local properties, containing object name mappings, e.g. via the "props" tag in XML bean definitions.
构造器详细资料
KeyNamingStrategy
public KeyNamingStrategy()
方法详细资料
setMappings
public void setMappings(Properties mappings)
Set local properties, containing object name mappings, e.g. via the "props" tag in XML bean definitions. These can be considered defaults, to be overridden by properties loaded from files.
setMappingLocation
public void setMappingLocation(Resource location)
Set a location of a properties file to be loaded, containing object name mappings.
setMappingLocations
public void setMappingLocations(Resource... mappingLocations)
Set location of properties files to be loaded, containing object name mappings.
afterPropertiesSet
public void afterPropertiesSet() throws IOException
Merges theProperties
configured in themappings
andmappingLocations
into the finalProperties
instance used forObjectName
resolution.- 指定者:
afterPropertiesSet
在接口中InitializingBean
- 抛出:
IOException
getObjectName
public ObjectName getObjectName(Object managedBean, @Nullable String beanKey) throws MalformedObjectNameException
Attempts to retrieve theObjectName
via the given key, trying to find a mapped value in the mappings first.- 指定者:
getObjectName
在接口中ObjectNamingStrategy
- 参数:
managedBean
- the bean that will be exposed under the returnedObjectName
beanKey
- the key associated with this bean in the beans map passed to theMBeanExporter
- 返回:
- the
ObjectName
instance - 抛出:
MalformedObjectNameException
- if the resultingObjectName
is invalid