1 package com.atlassian.plugin.osgi.spring.external;
2
3 import org.osgi.framework.Bundle;
4 import org.springframework.context.ConfigurableApplicationContext;
5
6 /**
7 * Hook to customize the spring application context before it is populated
8 *
9 * @since 2.6
10 */
11 public interface ApplicationContextPreProcessor
12 {
13 /**
14 * Detects if this bundle is a Spring bundle. This allows a pre-processor to have a Spring context built for a bundle
15 * even if the bundle doesn't have the Spring context header or any XML files in META-INF/spring.
16 *
17 * @param bundle The bundle to create an application context for
18 * @return True if a spring context should be created, false otherwise
19 */
20 boolean isSpringPoweredBundle(Bundle bundle);
21
22 /**
23 * Process a context before it is populated, usually via adding
24 * {@link org.springframework.beans.factory.config.BeanFactoryPostProcessor} instances.
25 *
26 * @param bundle The target bundle
27 * @param applicationContext The target application context before population
28 */
29 void process(Bundle bundle, ConfigurableApplicationContext applicationContext);
30 }