question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can you support read config from spring boot application.properties?

See original GitHub issue

like this(application.yml):

spring:
  datasource:
  # ...
  jpa:
    showSql: true
    hibernate:
      ddlAuto: validate
    properties:
      javax:
        persistence:
          sharedCache:
            mode: ALL
      hibernate:
        cache:
          use_second_level_cache: true
          use_query_cache: true
          transaction:
            factory_class: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory
          region:
            factory_class: org.hibernate.cache.redis.SingletonRedisRegionFactory
          redis:
            expiry_in_seconds: 0 #秒

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
debopcommented, Sep 1, 2016

OK, I will make it.

0reactions
GeBeatercommented, Sep 11, 2016

@Dreampie With the current pull request, I made it possible to configure hibernate via the “default” properties mechanism instead of the usage of an additional hibernate.properties file. In my use case, I am working with spring property files instead of yaml configuration which working fine. I guess that it should also work with yaml files because Using YAML instead of Properties is a feature of spring. However I have not try it and also did not investigate the spring sources regarding this.

Regarding the redis configuration. In my humble opinion it is good to keep the library framework independently. So I decided to reuse the injected properties instead of fetching any settings from the RedisCacheManager because this required an additional spring dependency. However @debop , as project owner, can give us a clear statement.

The next step I am going to reach is, that it is no more required to provide a redisson.yaml file. I try to find a solution that the settings contained in the redisson.yaml file can also used from files, maintained by spring. However this issue was not part of the pull request #67 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Tips: Configuration
The first step for most Spring Boot developers is to use application.properties. The Spring Initializr even puts an empty application.properties ...
Read more >
Springboot all possible ways to read props from Configuration ...
Reading a single property · Read bunch of properties then use can use @ConfigurationProperties. · Read entire YML/Property file.
Read more >
Spring Boot Read Values from Application Properties File
using @Value annotation in a non-Spring class has no effect. It can be used only in @Component, @Service, @Configuration classes; You can't bind ......
Read more >
Properties with Spring and Spring Boot - Baeldung
Boot applies its typical convention over configuration approach to property files. This means that we can simply put an application.properties ...
Read more >
Reading application.properties in Spring Boot
Another way to read application properties in the Spring Boot application is to use the @ConfigurationProperties annotation. To do that, we will ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found