<%#
 Copyright 2013-2025 the original author or authors from the JHipster project.

 This file is part of the JHipster project, see https://www.jhipster.tech/
 for more information.

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

      https://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-%>
# ===================================================================
# Spring Boot configuration for the "dev" profile.
#
# This configuration overrides the application.yml file.
#
# More information on profiles: https://www.jhipster.tech/profiles/
# More information on configuration properties: https://www.jhipster.tech/common-application-properties/
# ===================================================================

# ===================================================================
# Standard Spring Boot properties.
# Full reference is available at:
# http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html
# ===================================================================

logging:
  level:
    ROOT: DEBUG
    tech.jhipster: DEBUG
<%_ if (ormTool === 'hibernate') { _%>
    org.hibernate.SQL: WARN
<%_ } _%>
<%_ if (ormTool === 'mybatis') { _%>
    com.baomidou.mybatisplus: DEBUG
    com.diboot.core: DEBUG
<%_ } _%>
<%_ if (packageName !== 'tech.jhipster') { _%>
    <%= packageName %>: DEBUG
<%_ } _%>
<%_ if (databaseTypeNeo4j) { _%>
    org.neo4j.driver: WARN
<%_ } _%>
<%_ if (workflow === 'flowable') { _%>
    org.flowable: WARN
<%_ } _%>
<%_ if (serviceDiscoveryNacos) { _%>
    com.alibaba.nacos: WARN
<%_ } _%>

decorator:
  datasource:
    p6spy:
      enable-logging: true
      multiline: true
      logging: slf4j
      log-file: spy.log
      log-format: executionTime:%(executionTime) | sql:%(sqlSingleLine)
<%_ if (serviceDiscoveryEureka) { _%>

eureka:
  instance:
    prefer-ip-address: true
  client:
  <%_ if (applicationTypeMonolith) { _%>
    enabled: false # By default, the JHipster Registry is not used in the "dev" profile
  <%_ } _%>
    service-url:
      defaultZone: http://admin:${jhipster.registry.password}@localhost:8761/eureka/
<%_ } _%>

<%_ if (serviceDiscoveryAny || applicationTypeGateway || applicationTypeMicroservice || searchEngineElasticsearch) { _%>
management:
  <%_ if (searchEngineElasticsearch) { _%>
  health:
    elasticsearch:
      enabled: false
  <%_ } _%>
  <%_ if (serviceDiscoveryAny || applicationTypeGateway || applicationTypeMicroservice) { _%>
  zipkin: # Use the "zipkin" Maven profile to have the Spring Cloud Zipkin dependencies
    tracing:
      endpoint: http://localhost:9411/api/v2/spans
  tracing:
    sampling:
      probability: 1.0 # report 100% of traces
  <%_ } _%>
<%_ } _%>

<%_ if (databaseTypeNeo4j && !databaseMigrationLiquibase) { _%>
org:
  neo4j:
    migrations:
      locations-to-scan:
      packages-to-scan: <%= packageName %>.config.neo4j
      installed-by: <%= baseName %>
<%_ } _%>
spring:
  devtools:
    restart:
      enabled: true
      additional-exclude: static/**<% if (devDatabaseTypeH2Any) { %>,.h2.server.properties<% } %>
    livereload:
      enabled: false # we use Webpack dev server + BrowserSync for livereload
<%_ if (devDatabaseTypeH2Any && 'dockerServices' in locals && dockerServices?.length) { _%>
  docker:
    compose:
      enabled: <%- authenticationTypeOauth2 || messageBrokerAny || serviceDiscoveryAny || cacheProviderRedis %>
      profiles:
        active: dev
<%_ } _%>
  jackson:
    serialization:
      indent-output: true
<%_ if (databaseTypeNeo4j) { _%>
  neo4j:
    pool:
      metrics-enabled: true
    uri: bolt://localhost:7687
    # Uncomment to use an authenticated connection
    # authentication:
    #   username: neo4j
    #   password: secret
<%_ } _%>
<%_ if (serviceDiscoveryNacos) { _%>
  cloud:
    nacos:
      discovery:
        server-addr: 127.0.0.1:8848
<%_ } _%>
<%_ if (serviceDiscoveryConsul) { _%>
  cloud:
    consul:
      config:
        fail-fast: false # if not in "prod" profile, do not force to use Spring Cloud Config
        format: yaml
        profile-separator: '-'
      discovery:
        prefer-ip-address: true
        tags:
          - profile=${spring.profiles.active}
          - version='@project.version@'
          - git-version=${git.commit.id.describe:}
          - git-commit=${git.commit.id.abbrev:}
          - git-branch=${git.branch:}
      host: localhost
      port: 8500
<%_ } _%>
<%_ if (serviceDiscoveryEureka) { _%>
  cloud:
    config:
      uri: http://admin:${jhipster.registry.password}@localhost:8761/config
      # name of the config server's property source (file.yml) that we want to use
      name: <%= baseName %>
      profile: dev
      label: main # toggle to switch to a different version of the configuration as stored in git
      # it can be set to any label, branch or commit of the configuration source Git repository
<%_ } _%>
<%_ if (databaseTypeSql && !reactive) { _%>
  datasource:
    type: com.zaxxer.hikari.HikariDataSource
    url: <%- devJdbcUrl %>
    username: <%- devDatabaseUsername %>
    password: <%- devDatabasePassword %>
    hikari:
  <%_ if (devDatabaseTypeMysql || devDatabaseTypeMariadb) { _%><%# add by begcode start _%>
      connection-init-sql: SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
  <%_ } _%><%# add by begcode end _%>
      poolName: Hikari
      auto-commit: false
  <%_ if (devDatabaseTypeMysql || devDatabaseTypeMariadb || devDatabaseTypeMssql) { _%>
      data-source-properties:
        cachePrepStmts: true
        prepStmtCacheSize: 250
        prepStmtCacheSqlLimit: 2048
        useServerPrepStmts: true
  <%_ } _%>
<%_ } _%>
<%_ if (devDatabaseTypeH2Any) { _%>
  h2:
    console:
      # JHipster uses a custom h2-console initializer
  <%_ if (graalvmSupport) { _%>
      enabled: '@spring.h2.console.enabled@'
  <%_ } else { _%>
      enabled: true
  <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeSql && !reactive && devDatabaseType === 'dameng' && ormTool === 'hibernate') { _%> <%# add by begcode %>
  jpa:
    database-platform: org.hibernate.dialect.DmDialect
    properties:
      hibernate:
        dialect: org.hibernate.dialect.DmDialect
<%_ } _%>
<%_ if (databaseTypeMongodb) { _%>
  data:
    mongodb:
      uri: mongodb://localhost:27017/<%= baseName %><% if (reactive) { %>?waitQueueMultiple=1000<% } %>
<%_ } _%>
<%_ if (databaseTypeCassandra) { _%>
  cassandra:
    contact-points: localhost
    compression: LZ4
    keyspace-name: <%= baseName %>
    local-datacenter: datacenter1
<%_ } _%>
<%_ if (searchEngineElasticsearch) { _%>
  elasticsearch:
    uris: http://localhost:9200
<%_ } _%>
<%_ if (databaseTypeCouchbase) { _%>
  couchbase:
    connection-string: couchbase://localhost
    username: Administrator
    password: password
<%_ } _%>
<%_ if (databaseMigrationLiquibase) { _%>
  liquibase:
  <%_ if (!skipFakeData) { _%>
    # Remove 'faker' if you do not want the sample data to be loaded automatically
  <%_ } _%>
    contexts: dev<% if (!skipFakeData) { %>, faker<% } %>
  <%_ if (databaseTypeSql && reactive) { _%>
    url: <%- devJdbcUrl.replaceAll('&amp;', '&') %><%# modify by begcode %>
  <%_ } _%>
<%_ } _%>
<%_ if (generateUserManagement || builtInServices?.includes('idm')) { _%>
  mail:
    host: localhost
    port: 25
    username:
    password:
<%_ } _%>
  messages:
    cache-duration: PT1S # 1 second, see the ISO 8601 standard
<%_ if (databaseTypeSql && reactive) { _%>
  r2dbc:
    url: <%- devR2dbcUrl.replaceAll('&amp;', '&') %><%# modify by begcode %>
    username: <%- devDatabaseUsername %>
    password: <%- devDatabasePassword %>
<%_ } _%>
  thymeleaf:
    cache: false

server:
  port: <%= serverPort %>
  # make sure requests the proxy uri instead of the server one
  forward-headers-strategy: native

# ===================================================================
# JHipster specific properties
#
# Full reference is available at: https://www.jhipster.tech/common-application-properties/
# ===================================================================

jhipster:
<%_ if (applicationTypeGateway) { _%>
  gateway:
    rate-limiting:
      enabled: false
      limit: 100000
      duration-in-seconds: 3600
  <%_ if (!reactive) { _%>
    authorized-microservices-endpoints: # Access Control Policy, if left empty for a route, all endpoints will be accessible
      app1: /api,/v3/api-docs # recommended dev configuration
  <%_ } _%>
<%_ } _%>
<%_ if (databaseTypeCouchbase) { _%>
  database:
    couchbase:
      bucket-name: <%= baseName %>
      scope-name: <%= camelizedBaseName %>
<%_ } _%>
<%_ if (!cacheProviderNo) { _%>
  cache: # Cache configuration
  <%_ if (cacheProviderHazelcast) { _%>
    hazelcast: # Hazelcast distributed cache
      time-to-live-seconds: 3600
      backup-count: 1
  <%_ } _%>
  <%_ if (cacheProviderEhcache) { _%>
    ehcache: # Ehcache configuration
      time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache
      max-entries: 100 # Number of objects in each cache entry
  <%_ } _%>
  <%_ if (cacheProviderCaffeine) { _%>
    caffeine: # Caffeine configuration
      time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache. This sets expireAfterWrite in Caffeine (https://github.com/ben-manes/caffeine/wiki/Eviction#time-based)
      max-entries: 100 # Number of objects in each cache entry
  <%_ } _%>
  <%_ if (cacheProviderInfinispan) { _%>
    infinispan:
      config-file: default-configs/default-jgroups-tcp.xml
      statsEnabled: true
      # local app cache
      local:
        time-to-live-seconds: 3600 # By default objects stay 1 hour (in seconds) in the cache
        max-entries: 100 # Number of objects in each cache entry
      # distributed app cache
      distributed:
        time-to-live-seconds: 3600 # By default objects stay 1 hour (in seconds) in the cache
        max-entries: 100 # Number of objects in each cache entry
        instance-count: 1
      # replicated app cache
      replicated:
        time-to-live-seconds: 3600 # By default objects stay 1 hour (in seconds) in the cache
        max-entries: 100 # Number of objects in each cache entry
  <%_ } _%>
  <%_ if (cacheProviderMemcached) { _%>
    memcached: # Memcached configuration
      # Disabled by default in dev mode as Memcached does not work with Spring Boot Devtools
      # If you want to use Memcached, you must also enable it in CacheConfiguration
      enabled: false
  <%_ } _%>
  <%_ if (cacheProviderRedis) { _%>
    redis: # Redis configuration
      expiration: 3600 # By default objects stay 1 hour (in seconds) in the cache
      server: redis://localhost:6379
      cluster: false
      # server: redis://localhost:6379,redis://localhost:16379,redis://localhost:26379
      # cluster: true
  <%_ } _%>
<%_ } _%>
<%_ if (serviceDiscoveryEureka) { _%>
  registry:
    password: admin
<%_ } _%>
<%_ if (!applicationTypeMicroservice) { _%>
  # CORS is only enabled by default with the "dev" profile
  cors:
    # Allow Ionic for JHipster by default (* no longer allowed in Spring Boot 2.4+)
  <%_ const devServerPortList = [devServerPort];
      if (microfrontend) {
        for (let port = 1; port < 10; port++) {
          devServerPortList.push(devServerPort + port);
        }
      }
      if (!devServerPortList.includes(8100)) {
          devServerPortList.push(8100);
      }
      if (!devServerPortList.includes(devServerPortProxy) && devServerPortProxy) {
          devServerPortList.push(devServerPortProxy);
      }
      if (!devServerPortList.includes(3100)) {
        devServerPortList.push(3100);
      }
      devServerPortList.sort((a, b) => a - b);
  _%>
  <%_ if (microfrontend) { _%>
    # Ports <%= devServerPort + 1 %>-<%= devServerPort + 9 %> are allowed for microfrontend development
  <%_ } _%>
    allowed-origins: "<%_ if (!skipClient) { _%><%- devServerPortList.map(devServerPortItem => `http://localhost:${devServerPortItem},https://localhost:${devServerPortItem}`).join(',') %><%_ } _%>"
    # Enable CORS when running in GitHub Codespaces
    allowed-origin-patterns: 'https://*.githubpreview.dev'
    allowed-methods: "*"
    allowed-headers: "*"
  <%_ if (authenticationTypeSession) { _%>
    exposed-headers: "Link,X-Total-Count,X-${jhipster.clientApp.name}-alert,X-${jhipster.clientApp.name}-error,X-${jhipster.clientApp.name}-params"
  <%_ } else { _%>
    exposed-headers: "Authorization,Link,X-Total-Count,X-${jhipster.clientApp.name}-alert,X-${jhipster.clientApp.name}-error,X-${jhipster.clientApp.name}-params"
  <%_ } _%>
    allow-credentials: true
    max-age: 1800
<%_ } else { _%>
  # CORS is disabled by default on microservices, as you should access them through a gateway.
  # If you want to enable it, please uncomment the configuration below.
  # cors:
  #   allowed-origins: "http://localhost:9000,https://localhost:9000"
  #   allowed-methods: "*"
  #   allowed-headers: "*"
  #   exposed-headers: "Authorization,Link,X-Total-Count"
  #   allow-credentials: true
  #   max-age: 1800
<%_ } _%>
<%_ if (authenticationTypeJwt) { _%>
  security:
    authentication:
      jwt:
        # This token must be encoded using Base64 and be at least 256 bits long (you can type `openssl rand -base64 64` on your command line to generate a 512 bits one)
        base64-secret: <%= jwtSecretKey %>
        # Token is valid 24 hours
        token-validity-in-seconds: 86400
        token-validity-in-seconds-for-remember-me: 2592000
<%_ } _%>
<%_ if (authenticationTypeSession && !reactive) { _%>
  security:
    remember-me:
      # security key (this key should be unique for your application, and kept secret)
      key: <%= rememberMeKey %>
<%_ } _%>
<%_ if (generateUserManagement) { _%>
  mail: # specific JHipster mail property, for standard properties see MailProperties
    base-url: http://127.0.0.1:<%= serverPort %>
<%_ } _%>
  logging:
    use-json-format: false # By default, logs are not in Json format
    logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration
      enabled: false
      host: localhost
      port: 5000
      ring-buffer-size: 512
# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
# to have type-safe configuration, like in the JHipsterProperties above
#
# More documentation is available at:
# https://www.jhipster.tech/common-application-properties/
# ===================================================================

# application:

# jhipster-needle-add-config-yml
