View Javadoc
1   package com.atlassian.plugin.spring;
2   
3   import com.atlassian.plugin.osgi.hostcomponents.ContextClassLoaderStrategy;
4   
5   import java.lang.annotation.ElementType;
6   import java.lang.annotation.Retention;
7   import java.lang.annotation.RetentionPolicy;
8   import java.lang.annotation.Target;
9   
10  /**
11   * Annotation for Spring beans which are made available to OSGi plugin components.
12   * <p>
13   * This annotation may be used either on the bean class itself, or (since 4.2) alongside the
14   * {@link org.springframework.context.annotation.Bean} annotation on a bean definition method.
15   * <p>
16   * If a Class is specified, then the bean is exposed only as that class -- otherwise it is exposed as all interfaces it implements.
17   */
18  @Target({ElementType.TYPE, ElementType.METHOD})
19  @Retention(RetentionPolicy.RUNTIME)
20  public @interface AvailableToPlugins {
21      /**
22       * @return The interface the bean is to be exposed as.
23       */
24      Class value() default Void.class;
25  
26      /**
27       * @return The interfaces the bean is to be exposed as. If declared together with {#value}, the result will be
28       *         combined effect. However, it is highly recommended to use only one of them for clarity.
29       * @since 2.11.0
30       */
31      Class[] interfaces() default {};
32  
33      /**
34       * @return The context class loader strategy to use when determine which CCL should be set when host component
35       *         methods are invoked
36       */
37      ContextClassLoaderStrategy contextClassLoaderStrategy() default ContextClassLoaderStrategy.USE_HOST;
38  
39      /**
40       * @return {@code true} if the component should track which bundle is accessing it. {@code false} otherwise
41       * @see com.atlassian.plugin.osgi.hostcomponents.CallingBundleAccessor
42       * @since 3.1.0
43       */
44      boolean trackBundle() default false;
45  }