From c10449ec9eee54db1bb01dfb1fb2ec078f3f9b08 Mon Sep 17 00:00:00 2001 From: Guillermina Muro Date: Thu, 17 Jan 2019 15:47:43 -0800 Subject: [PATCH] updated readme, removed username from properies --- .gitignore | 6 +- Readme.md | 78 ++++++++++++++++++++++- src/main/resources/application.properties | 2 +- 3 files changed, 83 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 82eca33..f51d202 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,8 @@ /nbbuild/ /dist/ /nbdist/ -/.nb-gradle/ \ No newline at end of file +/.nb-gradle/ + + +.DS_Store + diff --git a/Readme.md b/Readme.md index 5c1f813..8a21886 100644 --- a/Readme.md +++ b/Readme.md @@ -1,3 +1,79 @@ + + +## what is your application? +Java application can be compiled down to one executable file (ex: .jar, .war). In our case, we will be creating a jar file that will be saved to a directory called __target__. +This can be done from your IDE (ex: Intellij, Eclipse). +```bash +$ mvn clean install +$ ls target +< there should be a bunch of files> +classes +generated-sources +generated-test-sources +maven-archiver +maven-status +postgres-demo-0.0.1-SNAPSHOT.jar +postgres-demo-0.0.1-SNAPSHOT.jar.original +surefire-reports +test-classes +``` +to run you application from the command line +```bash +$ java -jar target/postgres-demo-0.0.1-SNAPSHOT.jar +``` +## what does your application need to run? + +- java 8 + - maven +- database (ex: postgres) + - database table + - databese username + +You can check this information in the application. + +To find the java version, check the pom.xml +```bash +$ cat pom.xml +< lots of stuff will be in here> +... + postgres-demo + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 2.0.1.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + +... +``` + +```bash +$ cat src/main/resources/application.properties +## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) +spring.datasource.url=jdbc:postgresql://localhost:5432/postgres_demo +spring.datasource.username= +spring.datasource.password= + +# The SQL dialect makes Hibernate generate better SQL for the chosen database +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect + +# Hibernate ddl auto (create, create-drop, validate, update) +spring.jpa.hibernate.ddl-auto = update +``` + +In this example, our application uses a postgres database called _postgres_demo_. There is no username or password defined. + + + + +--------- ## Spring Boot, PostgreSQL, JPA, Hibernate REST API Demo ## Tutorial @@ -31,4 +107,4 @@ Alternatively, you can package the application in the form of a JAR file and the ```bash mvn clean package java -jar target/postgres-demo-0.0.1-SNAPSHOT.jar -``` \ No newline at end of file +``` diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ff398ee..fe65ade 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,6 @@ ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties) spring.datasource.url=jdbc:postgresql://localhost:5432/postgres_demo -spring.datasource.username= rajeevkumarsingh +spring.datasource.username= spring.datasource.password= # The SQL dialect makes Hibernate generate better SQL for the chosen database