com.ryantenney.metrics.spring.config.annotation.EnableMetrics Maven / Gradle / Ivy
Show all versions of metrics-spring Show documentation
/**
* Copyright (C) 2012 Ryan W Tenney ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ryantenney.metrics.spring.config.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.context.annotation.Import;
/**
* Add this annotation to an {@code @Configuration} class to have the Spring MVC
* configuration defined in {@link MetricsConfigurationSupport} imported.
*
* @see MetricsConfigurer
* @see MetricsConfigurerAdapter
*
* @author Ryan Tenney
* @since 3.0
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import(DelegatingMetricsConfiguration.class)
public @interface EnableMetrics {
/**
* Set whether the proxy should be exposed by the AOP framework as a
* ThreadLocal for retrieval via the AopContext class. This is useful
* if an advised object needs to call another advised method on itself.
* (If it uses this
, the invocation will not be advised).
* Default is "false", in order to avoid unnecessary extra interception.
* This means that no guarantees are provided that AopContext access will
* work consistently within any method of the advised object.
*/
boolean exposeProxy() default false;
/**
* Set whether to proxy the target class directly, instead of just proxying
* specific interfaces. Default is "false".
*
Set this to "true" to force proxying for the TargetSource's exposed
* target class. If that target class is an interface, a JDK proxy will be
* created for the given interface. If that target class is any other class,
* a CGLIB proxy will be created for the given class.
*
Note: Depending on the configuration of the concrete proxy factory,
* the proxy-target-class behavior will also be applied if no interfaces
* have been specified (and no interface autodetection is activated).
* @see org.springframework.aop.TargetSource#getTargetClass()
*/
boolean proxyTargetClass() default false;
}