The code in this repo is taken from Wim Deblauwe's book, Taming Thymeleaf. It took me about 2 months to work through this doing about four hours per week. This guide sets out how to get the project running locally.
- Docker
- Java 20
- Maven
- Create a
.envfile in the project root with three variables:- POSTGRES_DATABASE (the db name)
- POSTGRES_USER
- POSTGRES_PASSWORD
- Create an
application-local.propertiesfile undersrc/main/resourceswith these variables:- spring.datasource.url=jdbc:postgresql://localhost/<POSTGRES_DATABASE> (must match
.envfile) - spring.datasource.username=<POSTGRES_USER> (must match
.envfile) - spring.datasource.password=<POSTGRES_PASSWORD> (must match
.envfile) - spring.datasource.driver-class-name=org.postgresql.Driver
- spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
- spring.jpa.hibernate.ddl-auto=validate
- spring.thymeleaf.cache=false
- spring.web.resources.chain.cache=false
- spring.datasource.url=jdbc:postgresql://localhost/<POSTGRES_DATABASE> (must match
- Run
docker composein the project root to spin up the database - Run the
ThymeWizardApplicationwith two configured profiles,local, init-db, this will seed the database. You will see a list of created users appear in the Java console. - On second and subsequent runs, just use the
localprofile - Whilst the application is running navigate to the project root and run
npm run build && npm run watch. - A browser will open at
localhost:3000, you can log in using any email from thett_usertable, the password will be the user's first name. For example, if a user has the email 'calvin.harris@gmail.com' their password will be 'Calvin'. - You're in!