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

  • Home
  • SEARCH
  • 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 6858971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:13:33+00:00 2026-05-27T02:13:33+00:00

I want to be able to set default values for some fields in my

  • 0

I want to be able to set default values for some fields in my domain classes.
Till now I had a class which stored a Map of settings for my whole project, with a task in mind to move this map into a redis database.
The day has come and I moved all the data to redis and created a nice spring bean to get/set the values.
However…
it seems that default values are set on the domain class instance before bean is injected.
This kind of breaks the whole process.
Also… there’s an issue with unit tests.
I’ve created a class which implements the same interface as the spring bean and holds test values. I wanted to inject it into domain classes, but this fails as well.

So right now I’m trying to find a good way to handle externally stored defauls values for my domain classes with ability to run unit tests.
Any thoughts?

  • 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-27T02:13:34+00:00Added an answer on May 27, 2026 at 2:13 am

    What I did in the end:
    I’ve created a class which is connecting to Redis and gets me all the data I require.
    For unit testing I’ve created a copy of this class, it implements the same interface but instead of getting the data from Redis it has a simple Map inside and get’s the data from there. In the end it acts the same, but the data is stored internally. So in my unit tests I just inject this Unit test version of this class where appropriate.

    Probably not the best solution there is but it worked for me for the last few months.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to be able to set variables in a template to string values.
I have a class containing a set of attributes, which I want to be
I want to be able to set my country of origin - does this
I want to be able to make an HTTP call updating some select boxes
I have a non-nullable database column which has a default value set. When inserting
I want to set a default Margin of 3 on all the controls I
I have an app that I want the user to be able to set
I want to be able to set the color inside a Text Field to
I'm using awesome_nested_set for my central website structure. I want to be able to
I'm using LaTeX and BibTeX for an article, and I want to able to

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.