diff --git a/build.gradle b/build.gradle index ceb7d9efb..a3e9b6aa6 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,10 @@ plugins { id "io.spring.nohttp" version "0.0.11" } +plugins { + id "com.microsoft.azure.azurewebapp" version "1.10.0" +} + apply plugin: 'java' apply plugin: 'checkstyle' apply plugin: 'io.spring.javaformat' @@ -80,3 +84,16 @@ checkFormatAotTest.enabled = false formatAot.enabled = false formatAotTest.enabled = false + +azurewebapp { + subscription = 'c68c793f-ad34-4871-bb6d-88e912e3afc7' + resourceGroup = 'pa200_group' + appName = 'Petclinic-SpringApp' + pricingTier = 'B1' + region = 'westeurope' + runtime { + os = 'Linux' + webContainer = 'Tomcat 9.0' + javaVersion = 'Java 17' + } +} diff --git a/pom.xml b/pom.xml index b22644eee..5d628e5f0 100644 --- a/pom.xml +++ b/pom.xml @@ -139,6 +139,34 @@ jakarta.xml.bind-api + + mysql + mysql-connector-java + 8.0.33 + + + + com.azure.spring + spring-cloud-azure-dependencies + 5.12.0 + pom + import + + + + + com.microsoft.azure + azure-spring-boot-starter + 2.3.5 + + + + com.microsoft.sqlserver + mssql-jdbc + 6.4.0.jre8 + runtime + + @@ -220,7 +248,7 @@ spring-boot-maven-plugin - build-info @@ -378,7 +406,7 @@ - org.eclipse.m2e @@ -436,4 +464,4 @@ - \ No newline at end of file + diff --git a/src/main/resources/application-mysql.properties b/src/main/resources/application-mysql.properties deleted file mode 100644 index e23dfa605..000000000 --- a/src/main/resources/application-mysql.properties +++ /dev/null @@ -1,7 +0,0 @@ -# database init, supports mysql too -database=mysql -spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/petclinic} -spring.datasource.username=${MYSQL_USER:petclinic} -spring.datasource.password=${MYSQL_PASS:petclinic} -# SQL is written to be idempotent so this is safe -spring.sql.init.mode=always diff --git a/src/main/resources/application-postgres.properties b/src/main/resources/application-postgres.properties deleted file mode 100644 index 60889b43c..000000000 --- a/src/main/resources/application-postgres.properties +++ /dev/null @@ -1,6 +0,0 @@ -database=postgres -spring.datasource.url=${POSTGRES_URL:jdbc:postgresql://localhost/petclinic} -spring.datasource.username=${POSTGRES_USER:petclinic} -spring.datasource.password=${POSTGRES_PASS:petclinic} -# SQL is written to be idempotent so this is safe -spring.sql.init.mode=always diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5d3eeed32..27261a47a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,25 +1,14 @@ -# database init, supports mysql too -database=h2 +logging.level.org.hibernate.SQL=DEBUG +spring.datasource.url=jdbc:sqlserver://pa200-db-server.database.windows.net:1433;database=pa200_application_db;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30; + +spring.datasource.username=manager +spring.datasource.password=KDVYyIyKq8CRQ + +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2016Dialect +spring.jpa.hibernate.ddl-auto=create-drop + spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql -spring.sql.init.data-locations=classpath*:db/${database}/data.sql +spring.sql.init.data-locations=classpath*:db/data.sql +spring.jpa.defer-datasource-initialization= true -# Web -spring.thymeleaf.mode=HTML - -# JPA -spring.jpa.hibernate.ddl-auto=none -spring.jpa.open-in-view=true - -# Internationalization -spring.messages.basename=messages/messages - -# Actuator -management.endpoints.web.exposure.include=* - -# Logging -logging.level.org.springframework=INFO -# logging.level.org.springframework.web=DEBUG -# logging.level.org.springframework.context.annotation=TRACE - -# Maximum time static resources should be cached -spring.web.resources.cache.cachecontrol.max-age=12h +spring.sql.init.mode=always