Skip to content

Compile Time Constant Injection

Elliotte Rusty Harold edited this page Aug 14, 2017 · 1 revision

We plug a few constants into code at compile-time. We do this to avoid hard-coding these values and hamper their public visibilty.

Constant Bundle System Property
OAuth client ID login oauth.client.id
OAuth client secret login oauth.client.secret
Google Analytics Tracking ID usagetracking ga.tracking.id

The Java classes that hold these constant values are auto-generated from template Java source files, using the templating-maven-plugin. The values are populated from system properties in the auto-gen process. That is, for example, mvn -Doauth.client.id=id1234 templating:filter-sources or mvn -Doauth.client.id=id1234 package will result in injecting id1234 as an OAuth client ID.