Skip to content

Instantly share code, notes, and snippets.

@hadinajafi
Created February 1, 2021 09:40
Show Gist options
  • Select an option

  • Save hadinajafi/c86bd08d3c220dd64a67c2a81be0022c to your computer and use it in GitHub Desktop.

Select an option

Save hadinajafi/c86bd08d3c220dd64a67c2a81be0022c to your computer and use it in GitHub Desktop.
Most common spring application properties configurations
logging.level.root=info
##------------------------------------------------------
## Datasource Config
##------------------------------------------------------
spring.datasource.driver-class-name=org.postgresql.Driver
spring.jpa.properties.hibernate.id.new_generator_mappings=false
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
spring.datasource.hikari.initializationFailTimeout=15000
spring.jpa.database-platform=org
spring.datasource.url=jdbc:postgresql://localhost:5432/demo-service?useUnicode=true&characterEncoding=UTF-8
spring.datasource.username=postgres
spring.datasource.password=password
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.connection.characterEncoding=utf-8
spring.jpa.properties.hibernate.connection.CharSet=utf-8
spring.jpa.properties.hibernate.connection.useUnicode=true
##------------------------------------------------------
## swagger security
##------------------------------------------------------
swagger.enabled=true
springfox.documentation.swagger.v2.path=/api-docs
springfox.documentation.swagger.v1.path=/v1/api-docs
##------------------------------------------------------
## server config
##------------------------------------------------------
server.port=8080
server.servlet.context-path=/demo-service/v1
servlet.req.resp.log.enabled=true
spring.application.name=demo-service
##------------------------------------------------------
## Kafka config
##------------------------------------------------------
spring.kafka.bootstrap-servers=kafka:9092
spring.kafka.consumer.group-id=myGroup
@hadinajafi
Copy link
Author

hadinajafi commented Feb 7, 2021

logging.level.org.springframework.mail=DEBUG

spring.mail.host=smtp.gmail.com
spring.mail.port=587
spring.mail.username=username
spring.mail.password=password

# Other properties
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.connectiontimeout=5000
spring.mail.properties.mail.smtp.timeout=5000
spring.mail.properties.mail.smtp.writetimeout=5000
spring.mail.properties.mail.debug=true

# TLS , port 587
spring.mail.properties.mail.smtp.starttls.enable=true

# SSL, post 465
spring.mail.properties.mail.smtp.ssl.enable=true
spring.mail.properties.mail.smtp.socketFactory.port = 465
spring.mail.properties.mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory

# References
# https://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment