I added
<depends>jboss.jca:name=PostgresDS,service=XATxCM</depends>
<security-domain>EncryptXADBPassword</security-domain>
instead of
<xa-datasource-property name="User">$username}</xa-datasource-property>
<xa-datasource-property name="Password">${password}</xa-datasource-property>
and added in login-config.xml
<application-policy name="EncryptXADBPassword">
<authentication>
<login-module code="org.jboss.resource.security.SecureIdentityLoginModule" flag="required">
<module-option name="username">${username}</module-option>
<module-option name="password">6f8e652f571678f2</module-option>
<module-option name="managedConnectionFactoryName">jboss.jca:name=PostgresDS,service=XATxCM</module-option>
</login-module>
</authentication>
</application-policy>
But it did not start properly logged deployment failures. It might be related to my settings but if you say so that it should i will try again. Thanks