1

I'm workin in on java project ( with maven) I have a file (env-dev-windows.vars) for config like this :

APPLICATION_LOG_DIR=C:\DIRLOG
APPLICATION_BDD_URL=jdbc::PostgreSQL://localhost:5432/postgres
APPLICATION_USER=user_name
APPLICATION_PASSWD=passwd
...

in persistence.xml file instead of using the username and password like this :

    <property name="javax.persistence.jdbc.driver" value="org.postgresql.Driver" />
        <property name="javax.persistence.jdbc.url" value="jdbc:postgresql://localhost:5432/test" />
        <property name="javax.persistence.jdbc.user" value="postgres" />
        <property name="javax.persistence.jdbc.password" value="James123" />

I want to replace them with

System.getProperty("APPLICATION_USER") 
and System.getProperty("APPLICATION_PASSWD") 

I just want to use the Application properties and not for exemple ( the windows env variables defined in a local machine (in the parameters of a machine)

Is this possible ? for the moment I have no idea how to do it? is there another alternative

1 Answers1

0

Follow the below steps:

1- Inside the.xml file add these :

<parameter name="user key  " value= "user name" ></parameter>
<parameter pass="pass key  " value= "user pass" ></parameter>

2- Inside method:

System.getProperty("User Key here") 
and System.getProperty("pass  key here")