Skip to content

Commit

Permalink
remove yaml configuration from hibernate JPA guide
Browse files Browse the repository at this point in the history
See: #1356

properties
  • Loading branch information
sdelamo committed Nov 11, 2023
1 parent 3372d7f commit 3c729f4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 30 deletions.
2 changes: 1 addition & 1 deletion guides/micronaut-jpa-hibernate/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"apps": [
{
"name": "default",
"features": ["yaml","graalvm", "hibernate-jpa", "data-jpa", "serialization-jackson", "validation"]
"features": ["graalvm", "hibernate-jpa", "data-jpa", "serialization-jackson", "validation"]
}
]
}
4 changes: 2 additions & 2 deletions guides/micronaut-jpa-hibernate/micronaut-jpa-hibernate.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ dependency:jakarta.persistence-api[groupId=jakarta.persistence,version=2.2.3,cal

Define the data source in `src/main/resources/application.yml`.

common:yaml-dependency.adoc[]
Define the data source in `src/main/resources/application.properties`.

resource:application.yml[tag=datasource]
resource:application.properties[tag=datasource]

NOTE: This way of defining the datasource properties means that we can externalize the configuration, for example for production environment, and also provide a default value for development. If the environment variables are not defined the Micronaut framework will use the default values. +
Also keep in mind that it is necessary to escape the `:` in the connection URL using backticks ```.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
micronaut.application.name=micronautguide
#tag::application[]
application.max=50
#end::application[]
#tag::datasource[]
datasources.default.password=${JDBC_PASSWORD:""}
datasources.default.url=${JDBC_URL:`jdbc:h2:mem:default;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE`}
datasources.default.username=${JDBC_USER:sa}
datasources.default.driver-class-name=${JDBC_DRIVER:org.h2.Driver}
#end::datasource[]
#tag::jpa[]
jpa.default.properties.hibernate.hbm2ddl.auto=update
jpa.default.properties.hibernate.show_sql=true
#end::jpa[]
27 changes: 0 additions & 27 deletions guides/micronaut-jpa-hibernate/src/main/resources/application.yml

This file was deleted.

0 comments on commit 3c729f4

Please sign in to comment.