Go to file Use this template
Sambo Chea 1bc3057819
Some checks reported errors
continuous-integration/drone/push Build was killed
Updated github workflow
2023-03-09 19:07:28 +07:00
.github Updated github workflow 2023-03-09 19:07:28 +07:00
api Fixed and remove git source from build 2023-03-09 18:55:00 +07:00
apps/demo Add ci build and deploy 2022-10-03 08:35:12 +07:00
gradle/wrapper Update dependency gradle to v8.0.2 2023-03-04 05:33:53 +00:00
k8s Updated app k8s 2022-04-11 13:00:05 +07:00
.dockerignore Updated Dockerfile 2023-03-09 18:32:09 +07:00
.drone.yml Updated 2022-04-21 18:57:07 +07:00
.gitignore Completed upgraded the Spring Boot 3.x and Configuration 2022-12-05 20:45:16 +07:00
build-demo.sh Updated build scripts 2022-04-11 10:29:25 +07:00
build.gradle.kts Update plugin org.springframework.boot to v3.0.4 2023-03-04 05:33:58 +00:00
Dockerfile Fixed and remove git source from build 2023-03-09 18:55: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 Update dependency gradle to v8.0.2 2023-03-04 05:33:53 +00:00
gradlew.bat Update dependency gradle to v8.0.2 2023-03-04 05:33:53 +00:00
Jenkinsfile Create Jenkinsfile 2022-09-03 12:15:53 +07:00
README.md Completed upgraded the Spring Boot 3.x and Configuration 2022-12-05 20:45:16 +07:00
renovate.json Add renovate.json 2023-01-05 16:40:08 +00: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
system.properties Updated Dockerfile 2023-03-09 18:32:09 +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
  • Jenkins Support

Language and Framework

  • Spring Boot: 3.0.0
  • Kotlin: 1.7.22
  • Gradle: 7.5.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