Skip to content

putting properties as a resource is the WRONG way #15

Description

@homberghp

I noticed a bad example as a comment in the DBProvider class

It states

        // Usage of resource file is preferred way. No issues with working dir.
        // Uses the default location of resources (in src/main/java/resources dir)
        // getClassLoader() is necessary, unless you store your proprty file in a 
        // subfolder according to package name 
        // (src/main/resources/fontys/customerdbdemo in this case).

This is almost as wrong as putting passwords into the source code because:

  • src/main/resources is typically versioned, so any property file with passwords will be published in the repository. Bad.
  • said properties file will also land in the jar file, so it is published when packaging, installing and deploying as well. So just as bad.

The only way to deal with secrets is to keep them separate from the application binaries and put them in a well known but
protected place.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions