spring-petclinic / spring-petclinic-angularjs

AngularJS 1 and Spring Boot 2 version of the Spring Petclinic sample application
72 stars 95 forks source link

MySQL configuration #24

Open hackery opened 5 years ago

hackery commented 5 years ago

The main README includes this comment (inherited from spring-petclinic ?) but the code and comments seem to have diverged:

A similar setup is provided for MySql ...

There's no main/resources/application-mysql.properties for example. I'm trying to run this using the Docker image arey/springboot-petclinic adding in a likely properties file and hacking the classpath, but it's then failing with:

java.sql.SQLException: Unable to load class: com.mysql.jdbc.Driver

Is it missing the mysql-connector-java artifact? I've been looking to add the driver post-hoc but having trouble finding something suitable in the Alpine repo, or shoehorning changes into the startup. I'd rather find a repackaging solution than start hacking the build myself ...

arey commented 5 years ago

Hi @hackery. Yes, this angularjs repository is a fork of the one you reference. The MySQL support (code and documentation) has to be improve. If you are interested, I could work on it in the next days/weeks.

First, you may try to add the mysql-connecter-java artifact to the spring-petclinic-server/pom.xml

    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <scope>runtime</scope>
    </dependency>

You should rebuild the project and the Docker image. I suppose there is also some lines to change in the application.properties file.

arey commented 5 years ago

Hi @hackery. I've reworked the MySQL configuration. Please have a look on my commit 9a565ab I hope this help you to use MySQL.

hackery commented 5 years ago

[ ah - wrote this before seeing your update above - I'll check out the commit, tyvm ] Yes, I'm interested, if you have time to spare on it. I can send you whatever feedback might be useful. I've managed to bodge the mysql-connector into the runtime environment -

arey commented 5 years ago

I've published a docker-compose.yml file that start the Petclinic application with a MySQL database. The readme.md has been completed with a Docker usage documentation. Finally, I've published a new Docker image into https://cloud.docker.com/u/arey/repository/docker/arey/springboot-petclinic