From 8612835c82ede93fecc1ace357ae27a34a5fbbe0 Mon Sep 17 00:00:00 2001 From: Harkamal Randhawa Date: Wed, 4 Mar 2026 16:59:10 -0700 Subject: [PATCH] Initialize Spring Boot project --- backend/.gitignore | 35 ++++++ backend/pom.xml | 116 ++++++++++++++++++ .../petshop/backend/BackendApplication.java | 11 ++ backend/src/main/resources/application.yml | 43 +++++++ 4 files changed, 205 insertions(+) create mode 100644 backend/.gitignore create mode 100644 backend/pom.xml create mode 100644 backend/src/main/java/com/petshop/backend/BackendApplication.java create mode 100644 backend/src/main/resources/application.yml diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 00000000..16d47a38 --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1,35 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac ### +.DS_Store diff --git a/backend/pom.xml b/backend/pom.xml new file mode 100644 index 00000000..9b11bf68 --- /dev/null +++ b/backend/pom.xml @@ -0,0 +1,116 @@ + + + 4.0.0 + + + org.springframework.boot + spring-boot-starter-parent + 3.2.2 + + + + com.petshop + backend + 1.0.0 + PetShop Backend + Spring Boot backend for PetShop desktop application + + + 17 + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.boot + spring-boot-starter-validation + + + + com.mysql + mysql-connector-j + runtime + + + + org.flywaydb + flyway-core + + + + org.flywaydb + flyway-mysql + + + + io.jsonwebtoken + jjwt-api + 0.12.3 + + + + io.jsonwebtoken + jjwt-impl + 0.12.3 + runtime + + + + io.jsonwebtoken + jjwt-jackson + 0.12.3 + runtime + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.3.0 + + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.security + spring-security-test + test + + + + com.h2database + h2 + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + diff --git a/backend/src/main/java/com/petshop/backend/BackendApplication.java b/backend/src/main/java/com/petshop/backend/BackendApplication.java new file mode 100644 index 00000000..05cede40 --- /dev/null +++ b/backend/src/main/java/com/petshop/backend/BackendApplication.java @@ -0,0 +1,11 @@ +package com.petshop.backend; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class BackendApplication { + public static void main(String[] args) { + SpringApplication.run(BackendApplication.class, args); + } +} diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml new file mode 100644 index 00000000..07c5bff0 --- /dev/null +++ b/backend/src/main/resources/application.yml @@ -0,0 +1,43 @@ +spring: + application: + name: petshop-backend + + datasource: + url: ${DB_URL:jdbc:mysql://localhost:3306/petshop?createDatabaseIfNotExist=true} + username: ${DB_USERNAME:root} + password: ${DB_PASSWORD:password} + driver-class-name: com.mysql.cj.jdbc.Driver + + jpa: + hibernate: + ddl-auto: validate + show-sql: ${JPA_SHOW_SQL:false} + properties: + hibernate: + format_sql: true + dialect: org.hibernate.dialect.MySQLDialect + + flyway: + enabled: true + baseline-on-migrate: true + locations: classpath:db/migration + +server: + port: ${SERVER_PORT:8080} + servlet: + context-path: / + +springdoc: + api-docs: + path: /v3/api-docs + swagger-ui: + path: /swagger-ui + +jwt: + secret: ${JWT_SECRET:your-256-bit-secret-key-change-this-in-production-min-32-chars} + expiration: ${JWT_EXPIRATION:86400000} + +logging: + level: + com.petshop: ${LOG_LEVEL:INFO} + org.springframework.security: ${LOG_LEVEL_SECURITY:WARN}