Wednesday, December 13, 2017

How to assign annotation value from application.properties in Spring Boot?

Leave a Comment

I have an entity/model with discriminator formula and now I'm assigning a discriminator formula like the following sample,

@Entity @DiscriminatorFormula("type") class Student {     // code } 

In the same case, how can I assign discriminator value from application.properties in Spring Boot?

1 Answers

Answers 1

The expression in the class level annotation should be a constant, i.e, final and static .what you are trying to achieve is not possible. The best you can do is read it from a constant file rather than application.properties.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment