Go to file Use this template
2022-07-08 18:19:11 +07:00
.github Create dependabot.yml 2022-03-26 08:55:09 +07:00
api Updated and upgraded deps and config the props for openapi docs and modified for spring web modules 2022-06-13 19:50:22 +07:00
apps/demo Updated build scripts 2022-04-11 10:29:25 +07:00
gradle/wrapper Updated and upgraded deps and config the props for openapi docs and modified for spring web modules 2022-06-13 19:50:22 +07:00
k8s Updated app k8s 2022-04-11 13:00:05 +07:00
.drone.yml Updated 2022-04-21 18:57:07 +07:00
.gitignore Initial commit 2021-05-18 09:50:46 +07:00
build-demo.sh Updated build scripts 2022-04-11 10:29:25 +07:00
build.gradle.kts Bump plugin.spring from 1.7.0 to 1.7.10 2022-07-08 06:43:00 +00:00
Dockerfile Updated Dockerfile 2022-04-21 17:53:00 +07:00
generate-server-cert.sh Add generate server cert and add ssl for application 2022-04-20 17:24:51 +07:00
gradlew Initial commit 2021-05-18 09:50:46 +07:00
gradlew.bat Initial commit 2021-05-18 09:50:46 +07:00
README.md Update README.md 2022-06-13 20:05:07 +07:00
settings.gradle.kts Task: Add spring web modules for general purpose to use for extenal and internal modules and projects 2021-05-18 10:39:20 +07:00

CUBETIQ Web Modules (Template)

  • Setup and Default Web Configuration
  • Swagger UI and API's Documentation (SpringDoc)
  • General Purpose for External and Internal use-cases
  • Dockerfile and Docker profile build support
  • Kubernetes support

Language and Framework

  • Spring Boot: 2.7.0
  • Kotlin: 1.7.0
  • Gradle: 7.4.1

Modules

  • API (Default Module)

Spring Data

  • Add spring-data-jpa dependency in build.gradle.kts
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
  • Add spring-data-redis dependency in build.gradle.kts (Redis + Driver)
implementation("org.springframework.boot:spring-boot-starter-data-redis")

Spring Boot Properties

  • Recommend
spring:
  application:
    name: ${APP_NAME:spring-web-api}
app:
  data-dir: ${APP_DATA_DIR:${user.home}/${spring.application.name}}
  • Upload File Properties
server:
  tomcat:
    max-http-form-post-size: ${SERVER_MAX_HTTP_FORM_POST_SIZE:50MB}

spring:
  servlet:
    multipart:
      max-file-size: 256MB
      max-request-size: 256MB
      enabled: true
  • Logging
logging:
  file:
    path: ${LOGGING_FILE_PATH:${app.data-dir}/logs/}
    name: ${logging.file.path}/app.log

Spring Data Redis

  • Redis Properties
spring:
  redis:
    host: ${REDIS_HOST:localhost}
    port: ${REDIS_PORT:6379}
    password: ${REDIS_PASSWORD:your_password}

Spring Data JPA Properties

  • Datasource Enhancement (Default: PostgresSQL)
spring:
  datasource:
    driverClassName: ${DATA_SOURCE_DRIVER_CLASS_NAME:org.postgresql.Driver}
    url: ${DATA_SOURCE_URL:jdbc:postgresql://localhost:5432/demo}
    username: ${POSTGRES_USERNAME:postgres}
    password: ${POSTGRES_PASSWORD:postgres}
    hikari:
      max-lifetime: ${DATA_SOURCE_MAX_LIFETIME:1800000}
      connection-timeout: ${DATA_SOURCE_CONNECTION_TIMEOUT:30000}
      idle-timeout: ${DATA_SOURCE_IDLE_TIMEOUT:600000}
      maximum-pool-size: ${DATA_SOURCE_MAXIMUM_POOL_SIZE:10}
      allow-pool-suspension: ${DATA_SOURCE_ALLOW_POOL_SUSPENSION:true}
    tomcat:
      max_active: ${DATA_SOURCE_TOMCAT_MAX_ACTIVE:100}
      max_idle: ${DATA_SOURCE_TOMCAT_MAX_IDLE:10}
      min-idle: ${DATA_SOURCE_TOMCAT_MIN_IDLE:10}
      initial_size: ${DATA_SOURCE_TOMCAT_INITIAL_SIZE:10}
      remove_abandoned: ${DATA_SOURCE_TOMCAT_REMOVE_ABANDONED:true}
  jpa:
    database-platform: ${JPA_DATABASE_PLATFORM:org.hibernate.dialect.PostgreSQLDialect}
    show-sql: ${JPA_SHOW_SQL:false}
    hibernate:
      ddl-auto: ${JPA_HIBERNATE_DDL_AUTO:update}
    properties:
      hibernate:
        dialect: ${JPA_HIBERNATE_DIALECT:org.hibernate.dialect.PostgreSQLDialect}
    open-in-view: ${JPA_OPEN_IN_VIEW:false}
  • PostgreSQL
spring:
  datasource:
    driverClassName: ${DATA_SOURCE_DRIVER_CLASS_NAME:org.postgresql.Driver}
    url: jdbc:postgresql://${POSTGRES_HOST:localhost}:${POSTGRES_PORT:5432}/${POSTGRES_DB:demo}
    username: ${POSTGRES_USERNAME:postgres}
    password: ${POSTGRES_PASSWORD:postgres}
  • MySQL
spring:
  datasource:
    driverClassName: ${DATA_SOURCE_DRIVER_CLASS_NAME:com.mysql.cj.jdbc.Driver}
    url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DB:demo}?createDatabaseIfNotExist=true&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
    username: ${MYSQL_USERNAME:demo}
    password: ${MYSQL_PASSWORD:demo}
  jpa:
    database-platform: ${JPA_DATABASE_PLATFORM:org.hibernate.dialect.MySQLDialect}
    properties:
      hibernate:
        dialect: ${JPA_HIBERNATE_DIALECT:org.hibernate.dialect.MySQLDialect}
  • H2 (Embedded)
spring:
  datasource:
    driverClassName: ${DATA_SOURCE_DRIVER_CLASS_NAME:org.h2.Driver}
    url: jdbc:h2:file:${H2_DB_PATH:./data/db};DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
    username: ${H2_USERNAME:sa}
    password: ${H2_PASSWORD:password}
  jpa:
    database-platform: ${JPA_DATABASE_PLATFORM:org.hibernate.dialect.H2Dialect}
  h2:
    console:
      enabled: ${H2_CONSOLE_ENABLED:true}
  • Avoid the Lazy Initialization Problem
spring:
  jpa:
    properties:
      hibernate:
        enable_lazy_load_no_trans: ${HIBERNATE_LAZY_NO_TRANS:true}

Contributors