You should not be hard-coding database connection information into a webapp. Webapps should use Database Connection Pools. They are much more efficient and much more flexible than brute-force database connections done in the app itself.
Connection pools are configured as part of the webserver, not the webapp, although you can generally define a pool specific to a single webapp and put its characteristics in as part of the server-specific deployment information. For example, a context.xml for Tomcat.
The webapp presents the Connection pool(s) defined for it via JNDI. In Spring, you can reference a pool like this:
Where I defined my pool as jdbc/localDB in my context.xml file when I deployed the webapp. You should then be able to use myDataSource.getConnection() to obtain a connection to work with.
Note that pool connections MUST NOT be held long-term. Use a pool connection for as little time as possible, then close it to return it to the pool so that it will be available to other webapp users. NEVER hold a connection between web requests (that's also true for non-pool connections, by the way).
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.