001/* 002 * Copyright 2002-2015 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.jmx.export.annotation; 018 019import java.lang.annotation.Documented; 020import java.lang.annotation.ElementType; 021import java.lang.annotation.Inherited; 022import java.lang.annotation.Retention; 023import java.lang.annotation.RetentionPolicy; 024import java.lang.annotation.Target; 025 026import org.springframework.core.annotation.AliasFor; 027 028/** 029 * Class-level annotation that indicates to register instances of a class 030 * with a JMX server, corresponding to the {@code ManagedResource} attribute. 031 * 032 * <p><b>Note:</b> This annotation is marked as inherited, allowing for generic 033 * management-aware base classes. In such a scenario, it is recommended to 034 * <i>not</i> specify an object name value since this would lead to naming 035 * collisions in case of multiple subclasses getting registered. 036 * 037 * @author Rob Harrop 038 * @author Juergen Hoeller 039 * @author Sam Brannen 040 * @since 1.2 041 * @see org.springframework.jmx.export.metadata.ManagedResource 042 */ 043@Target(ElementType.TYPE) 044@Retention(RetentionPolicy.RUNTIME) 045@Inherited 046@Documented 047public @interface ManagedResource { 048 049 /** 050 * Alias for the {@link #objectName} attribute, for simple default usage. 051 */ 052 @AliasFor("objectName") 053 String value() default ""; 054 055 @AliasFor("value") 056 String objectName() default ""; 057 058 String description() default ""; 059 060 int currencyTimeLimit() default -1; 061 062 boolean log() default false; 063 064 String logFile() default ""; 065 066 String persistPolicy() default ""; 067 068 int persistPeriod() default -1; 069 070 String persistName() default ""; 071 072 String persistLocation() default ""; 073 074}