org.apache.camel.spring.javaconfig.test
Class JavaConfigContextLoader

java.lang.Object
  extended by org.apache.camel.spring.javaconfig.test.JavaConfigContextLoader
All Implemented Interfaces:
org.springframework.test.context.ContextLoader

Deprecated. Use org.apache.camel.test.spring.CamelSpringDelegatingTestContextLoader from camel-test-spring jar instead.

@Deprecated
public class JavaConfigContextLoader
extends Object
implements org.springframework.test.context.ContextLoader

Implementation of the ContextLoader strategy for creating a AnnotationConfigApplicationContext for a test's @ContextConfiguration

Example usage:

 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = {"com.myco.TestDatabaseConfiguration", "com.myco.config"},
                       loader = JavaConfigContextLoader.class)
 public MyTests { ... }
 

Implementation note: At this time, due to restrictions in Java annotations and Spring's TestContext framework, locations of classes / packages must be specified as strings to the ContextConfiguration annotation. It is understood that this has a detrimental effect on type safety, discoverability and refactoring, and for these reasons may change in future revisions, possibly with a customized version of the ContextConfiguration annotation that accepts an array of class literals to load.

See Also:
ContextConfiguration

Field Summary
protected  org.slf4j.Logger logger
          Deprecated.  
 
Constructor Summary
JavaConfigContextLoader()
          Deprecated.  
 
Method Summary
 org.springframework.context.ApplicationContext loadContext(String... locations)
          Deprecated. Loads a new context based on the supplied locations, configures the context, and finally returns the context in fully refreshed state.
 String[] processLocations(Class<?> clazz, String... locations)
          Deprecated. Simply returns the supplied locations unchanged.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Deprecated. 
Constructor Detail

JavaConfigContextLoader

public JavaConfigContextLoader()
Deprecated. 
Method Detail

processLocations

public String[] processLocations(Class<?> clazz,
                                 String... locations)
Deprecated. 
Simply returns the supplied locations unchanged.

Specified by:
processLocations in interface org.springframework.test.context.ContextLoader
Parameters:
clazz - the class with which the locations are associated: used to determine how to process the supplied locations.
locations - the unmodified locations to use for loading the application context; can be null or empty.
Returns:
an array of application context resource locations
See Also:
ContextLoader.processLocations(Class, String[])

loadContext

public org.springframework.context.ApplicationContext loadContext(String... locations)
Deprecated. 
Loads a new context based on the supplied locations, configures the context, and finally returns the context in fully refreshed state.

Configuration locations are either fully-qualified class names or base package names. These locations will be given to a AnnotationConfigApplicationContext for configuration via the AnnotationConfigApplicationContext.register(Class[]) and AnnotationConfigApplicationContext.scan(String...) methods.

Specified by:
loadContext in interface org.springframework.test.context.ContextLoader
Parameters:
locations - the locations to use to load the application context
Returns:
a new application context
Throws:
IllegalArgumentException - if any of locations are not valid fully-qualified Class or Package names


Apache Camel