Spring @Profile and @Entity

Issue

Does the org.springframework.context.annotation.Profile annotation work with javax.persistence.Entity annotation ?
It seems that no.

Thanks for your help.

Solution

Spring is only managing Spring components. Usually the components are stateless services.

If the class (with or without the @Entity annotation) is not created by Spring, the @Profile annotation won’t work.

Answered By – Danix

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published