Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7551331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:27:58+00:00 2026-05-30T10:27:58+00:00

First, some context: I’m currently working on a project in which I use the

  • 0

First, some context:

I’m currently working on a project in which I use the Spring framework on Google’s AppEngine (GAE) to fetch some data from one of Google’s services. To do so, I make use of Google’s OAuth facilities. For this, I need to use a clientSecret and clientId that are specific to my application. As these are static configuration values, I use Spring’s <util:properties> (link to documentation) functionality to insert these values into the appropriate classes.

XML config:

<util:properties id="googleProperties" location="WEB-INF/google.properties" />

Class usage:

@Value("#{googleProperties['google.data.api.client.id']}")
private String clientId;

My Question:

As it turns out, the values of clientId and clientSecret need to be different for production (when deployed on App Engine) as for development (on my local machine). In order to solve this without constantly needing to change the values in the properties file when deploying, I have been looking into Spring’s configuration profiles that would allow me to specify different property files for production and for development. Although I have an idea how Spring profiles work based on the documentation, I am not at all sure what the appropriate solution would be in this particular situation.

In other words, how can I inject different property files based on whether my application is deployed locally or on GAE?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:27:59+00:00Added an answer on May 30, 2026 at 10:27 am

    A couple of options:


    System Variables

    You can use a prefix to control environment specific properties, this can be done by using system variables:

     <util:properties id="googleProperties" 
                      location="WEB-INF/${ENV_SYSTEM:dev}/google.properties" />
    

    In this case it will always look under:

     <util:properties id="googleProperties" 
                      location="WEB-INF/dev/google.properties" />
    

    by default, unless a ENV_SYSTEM system variable is set. If it is set to qa, for example, it will automatically look under:

     <util:properties id="googleProperties" 
                      location="WEB-INF/qa/google.properties" />
    

    Spring Profiles

    Another approach is to make beans profile specific. For example:

    <beans profile="dev">
        <util:properties id="googleProperties" 
                         location="WEB-INF/google-dev.properties" />
    </beans>
    
    <beans profile="qa">
        <util:properties id="googleProperties" 
                         location="WEB-INF/google-qa.properties" />
    </beans>
    

    The appropriate googleProperties will loaded depending on a profile set. For example this will load WEB-INF/google-dev.properties:

    GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
    ctx.getEnvironment().setActiveProfiles( "dev" );
    ctx.load( "classpath:/org/boom/bang/config/xml/*-config.xml" );
    ctx.refresh();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First some context: I have an MVC3 .net project which, for the sake of
First some background, I am currently working on a relatively large Asp.Net MVC application
First some background: I'm working on an application and I'm trying to follow MVVM
To provide some context, I'm interested in the creation of an app which allows
I've got some soapUI tests, that use groovy scripts to first insert some data
First of all, I'll clarify some words: when I use the word user you
I am encountering some performance problems with my Entity Framework Code-First queries and I
First here's some context on what I want to achieve. I'm writing a small
First of all some context : I have a form, where I post back
I have a TextBox which has some default context menu and it works fine.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.