JUnit + Spring profiles: could not load JDBC driver class
<p>How fix next exception?</p>

<p>Can not see any problems in configuration.</p>

<p>It worked well, but after some refactoring failed.</p>

<p><strong>Exception</strong></p>

<pre><code>java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)
...Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [${jdbc.driverClassName}]
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:121)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:75)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1514)
... 52 more
</code></pre>

<p><strong>Configuration</strong></p>

<p>JUnit</p>

<pre><code>@ActiveProfiles("test")
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = SpringHsqlTest.class)
@TestExecutionListeners({DependencyInjectionTestExecutionListener.class,
    DirtiesContextTestExecutionListener.class,
    TransactionalTestExecutionListener.class,
    DbUnitTestExecutionListener.class,
    ForeignKeyBreakTestExecutionListener.class})
@ContextConfiguration({"classpath:contexts/bean-locations.xml"})
public class SpringHsqlTest {//...
</code></pre>

<p>From pom.xml</p>

<pre><code>   &lt;dependency&gt;
        &lt;groupId&gt;org.hsqldb&lt;/groupId&gt;
        &lt;artifactId&gt;hsqldb&lt;/artifactId&gt;
        &lt;version&gt;2.3.3&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
    &lt;/dependency&gt;
</code></pre>

<p>profiles.xml</p>

<pre><code>&lt;beans profile="test"&gt;
    &lt;context:property-placeholder ignore-resource-not-found="false"
                                  location="classpath*:properties/test-database.properties"/&gt;
&lt;/beans&gt;
</code></pre>

<p>From data-source.xml</p>

<pre><code>&lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
    &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&gt;
    &lt;property name="username" value="${jdbc.userName}"/&gt;
    &lt;property name="password" value="${jdbc.password}"/&gt;
    &lt;property name="url" value="${jdbc.url}"/&gt;
&lt;/bean&gt;
</code></pre>

<p>properties/test-database.properties</p>

<pre><code>jdbc.dialect=H2Dialect
jdbc.driverClassName=org.hsqldb.jdbcDriver
jdbc.url=jdbc:hsqldb:mem:dbtest-local
jdbc.userName=sa
jdbc.password=
</code></pre>