On my local machine I am creating Java EE Maven project on Tomcat7 that collaborates with local MySQL database.
For now I have all db connection settings like (user, password, host, dbname, ... etc) hardcoded in DatabaseQueries.java directly in Java EE Maven project, but I know it is not right and I want to take out this setting from project for example to db.properties file, so when I deploy the project on my remote Tomcat7 server it will use different db.properties file with corresponing settings or if I share the project in GitHub, other people will not see my db username and password.
Thus I have few questions:
What is the best practice of externalizing the db settings from Maven project ?
Does Maven project has already build-in functionality to do this ?
How to be sure, that when I export a project as a *.WAR file it will not include this db.properties file ?
Is it correct to use the name as "db.properties" for this purposes ?