admin管理员组

文章数量:1126441

For example, the configuration property spring.main.log-startup-info would be an environment variable named SPRING_MAIN_LOGSTARTUPINFO

This is simple and only control feature from spring-boot.

But this spring.jpa.properties.hibernate.session.events.log.LOG_QUERIES_SLOWER_THAN_MS contains uppercase and underscore.

How convert this properties

I read this instructions

Binding From Environment Variables

and I try convert this: spring.jpa.properties.hibernate.session.events.log.LOG_QUERIES_SLOWER_THAN_MS

to this SPRING_JPA_PROPERTIES_HIBERNATE_SESSION_EVENTS_LOG_LOG_QUERIES_SLOWER_THAN_MS

but not works when export to linux ubuntu environment.

For example, the configuration property spring.main.log-startup-info would be an environment variable named SPRING_MAIN_LOGSTARTUPINFO

This is simple and only control feature from spring-boot.

But this spring.jpa.properties.hibernate.session.events.log.LOG_QUERIES_SLOWER_THAN_MS contains uppercase and underscore.

How convert this properties

I read this instructions

Binding From Environment Variables

and I try convert this: spring.jpa.properties.hibernate.session.events.log.LOG_QUERIES_SLOWER_THAN_MS

to this SPRING_JPA_PROPERTIES_HIBERNATE_SESSION_EVENTS_LOG_LOG_QUERIES_SLOWER_THAN_MS

but not works when export to linux ubuntu environment.

Share Improve this question asked 2 days ago Carlos EduardoCarlos Eduardo 1141 silver badge5 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You could keep the mentioned property in application.yml and populate its value from arbitrary environment variable. Just export the variable in the terminal:

export LOG_QUERIES_SLOWER_THAN_MS=20

and specify this in your config file:

spring:
  jpa:
    properties:
      hibernate.session.events.log.LOG_QUERIES_SLOWER_THAN_MS: ${LOG_QUERIES_SLOWER_THAN_MS:10}

Here LOG_QUERIES_SLOWER_THAN_MS is be the name of referenced environment variable and 10 the default value applied when the variable is not set.

本文标签: