Read Environment Variables in persistence.xml file

前端 未结 3 1260
陌清茗
陌清茗 2020-12-16 02:53

I want to read environment variables inside persistence.xml file.

Idea is that i don\'t want my database details to be read from properties file as

3条回答
  •  -上瘾入骨i
    2020-12-16 03:31

    You could use this working example.

    It gets all properties defined in the persistence.xml from the PersistenceUnitInfo instance which is obtained from the EntityManagerFactory (by using eclipseLink specific implementations). These properties get replaced with the values defined in environment variables.

提交回复
热议问题