SpringBoot loader.path Unable to load external Jar
<p>I am using springboot for a webapp and I am attempting to setup an external directory that will hold various JDBC drivers that an end user may select to use.  To do this I am adding:  </p>

<pre><code>loader.path=/opt/myapp/lib/
</code></pre>

<p>to my application.properties file, and this is picked up by the PropertySourcesPropertyResolver</p>

<pre><code>2016-04-28 17:27:38.739 DEBUG 22539 --- [restartedMain] o.s.c.e.PropertySourcesPropertyResolver  : Found key 'loader.path' in [applicationConfigurationProperties] with type [String] and value '/opt/myapp/lib/'
</code></pre>

<p>My problem is I can't seem to load any JDBC drivers from any jars that I drop into this directory, what am I missing?  I am using the default embedded tomcat server.  When I attempt to load the driver using Class.forName, I get the following, like the jars aren't present in that directory. </p>

<pre><code> public Connection buildConnection(DataSource dataSource) throws ClassNotFoundException, SQLException {

    if (dataSource == null) {
        throw new NullPointerException("Data Source is null!");
    }

    if (!dataSource.isReady()) {
        throw new IllegalArgumentException("Data Source is reporting that it is not ready!");
    }

    logger.debug("Loading JDBC Driver: {}", dataSource.getDriverClass());
    Class.forName(dataSource.getDriverClass());
    logger.debug("Loaded Driver: {}", dataSource.getDriverClass());

    logger.debug("Attempting to build connection using: {}", dataSource.getConnectionString());

    DriverManager.setLoginTimeout(10);
    Connection c = DriverManager.getConnection(dataSource.getConnectionString(), dataSource.getUserName(), dataSource.getPassword());
    if (c != null) {
        c.setAutoCommit(true);
        c.setReadOnly(true);
        return c;
    }
    throw new NullPointerException("Unable to create connection!");
} 
</code></pre>

<p>This is the exception that is thrown</p>

<pre><code>2016-04-28 17:38:53.525 DEBUG 22539 --- [nio-8081-exec-5] c.c.reportout.processor.JobProcessor     : Loading JDBC Driver: com.mysql.jdbc.Driver
2016-04-28 17:38:53.526  WARN 22539 --- [nio-8081-exec-5] c.c.reportout.processor.JobProcessor     : Unable to successfully test connection: com.mysql.jdbc.Driver

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_91]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_91]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_91]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_91]
at org.springframework.boot.devtools.restart.classloader.RestartClassLoader.loadClass(RestartClassLoader.java:151) ~[spring-boot-devtools-1.3.3.RELEASE.jar:1.3.3.RELEASE]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_91]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_91]
at java.lang.Class.forName(Class.java:264) ~[na:1.8.0_91]
</code></pre>

<p>Any pointers as to how I can debug this or what I am doing wrong?</p>

<p>Thanks</p>