daily pastebin goal
62%
SHARE
TWEET

Untitled

a guest Mar 17th, 2018 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import com.googlecode.objectify.ObjectifyService
  2. import com.googlecode.objectify.annotation.Entity
  3. import com.googlecode.objectify.annotation.Id
  4. import org.springframework.context.annotation.Bean
  5. import org.springframework.stereotype.Configuration
  6.  
  7. internal interface DynamicConfiguration {
  8.     var id: String
  9.     var databaseURL: String
  10.     var databaseUser: String
  11.     var databasePassword: String
  12. }
  13.  
  14. @Entity(name = "Configuration")
  15. internal class DynamicConfigurationImpl(@Id override var id: String = "",
  16.                                         override var databaseURL: String = "",
  17.                                         override var databaseUser: String = "",
  18.                                         override var databasePassword: String = "") : DynamicConfiguration
  19.  
  20. @Configuration
  21. internal class DynamicConfigurationLoader {
  22.  
  23.     @Bean
  24.     fun dynamicConfiguration(): DynamicConfiguration {
  25.         ObjectifyService.register(DynamicConfigurationImpl::class.java)
  26.         return ObjectifyService.run({ ObjectifyService.ofy().load().type(DynamicConfigurationImpl::class.java).id("MyService").now() })
  27.     }
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top