Question: How can I go about loading a Spring context with my own `ClassLoader` instance?

Answer: 
```
    final ClassLoader properClassLoader = YourClass.class.getClassLoader();

    appContext = new ClassPathXmlApplicationContext("application-context.xml") {

        protected void initBeanDefinitionReader(XmlBeanDefinitionReader reader) {
            super.initBeanDefinitionReader(reader);
            reader.setValidationMode(XmlBeanDefinitionReader.VALIDATION_NONE);
            reader.setBeanClassLoader(properClassLoader);
            setClassLoader(properClassLoader);

```

See here if you are doing this for OSGI purposes: [How do I use a Spring bean inside an OSGi bundle?](https://stackoverflow.com/questions/8039931/how-do-i-use-a-spring-bean-inside-an-osgi-bundle)
People who are using spring boot and wants to use custom classloader to create application context can do it like this:

```
@SpringBootApplication
public class Application
{

public static void main(String[] args) {

        SpringApplication app =
            new SpringApplication(Application.class);

        ResourceLoader resourceLoader = new DefaultResourceLoader();

        YourClassLoaderObject yourClassLoaderObject = new YourClassLoaderObject();

        ((DefaultResourceLoader)resourceLoader).setClassLoader(yourClassLoaderObject);

        app.setResourceLoader(resourceLoader);

        context = app.run(args);

    }

}

```