Read spring properties from liquibase properties

491 Views Asked by At

I have a Spring Boot application that reads a property file defined in "D:\Project\conf_files".

@PropertySource(value = {"file:D:\\\\Project\\\\conf_files\\\\internal.properties"}, ignoreResourceNotFound = false)
public class MyApplication extends SpringBootServletInitializer {
    
    public static void main(String[] args) {
        SpringApplication.run(MyApplication .class, args);
    }
}

In the "internal.properties" file, I have defined Liquibase properties:

liquibase.database.driverClassName=com.mysql.jdbc.Driver
liquibase.database.url=jdbc:mysql://127.0.0.1:3306/customers
liquibase.database.user=root
liquibase.database.pwd=

I have also defined "liquibase.properties" as follows:

changeLogFile=src/main/resources/changelogs/db.changelog-master.xml
driver=${liquibase.database.driverClassName}
url=${liquibase.database.url}
username=${liquibase.database.user}
password=${liquibase.database.pwd}

The "liquibase-maven-plugin" in my project points to the Liquibase path as follows:

<plugin>
    <groupId>org.liquibase</groupId>
    <artifactId>liquibase-maven-plugin</artifactId>
    <version>${liquibase.version}</version>
        <configuration>
            <propertyFile>${basedir}/src/main/resources/liquibase.properties</propertyFile>-->
        </configuration>
    <executions>
        <execution>
            <id>liquibase-update</id>
            <phase>process-resources</phase>
            <goals>
                <goal>updateSQL</goal>
                <goal>update</goal>
            </goals>
        </execution>
    </executions>
</plugin>

However, I am encountering the following error:

[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.5:updateSQL (liquibase-update) on project chorniche-client-angular: Error setting up or running Liquibase: liquibase.exception.DatabaseException: java.lang.RuntimeException: Cannot find database driver: ${liquibase.database.driverClassName}

Am I missing something ??

0

There are 0 best solutions below