java - How to dynamically populate @Value property from local property file in Spring? -
i having issue setting property need use in code. in class, i've declared property so:
@value("${foo.password}") private string foopassword;
this fine, there bit of wrinkle when comes how property file i'm pulling stored in other environments. in of our upper environments, our value stored encrypted. however, in our dev environment, don't have ability decrypt value must store decrypted. encrypted values stored 1 key, while decrypted values stored key.
in order make generic solution, i'd love able specify backup value in @value annotation. like...
@value("${foo.passwordencrypted ? foo.passworddecrypted }") private string foopassword;
... in dev environment can grab decrypted value, while upper environemnts can grab encrypted value , needs do.
is can achieved @value? possible create our own custom annotation similar?
i believe looking "default" value? in case use way
@value("${foo.passwordencrypted:default_decrypted_value}")
Comments
Post a Comment