4

This question about default values for the Spring @Value annotation describes exactly the problem I am facing. It has a very clear answer that has been up-voted and accepted. Unfortunately the answer doesn't solve the problem for me. It apparently does work for other people.

I left a comment on the answer describing my findings. I would like knowledgable Spring people to take a look at the issue again and to see if they can come up with another cause for these symptoms, and use that to add another answer. I would also like to avoid asking a new question that was immediately flagged and closed as as being duplicate. (I really don't have much info to add to the question other than mentioning the version of Spring. I did in the comment.)

Other than saying I already looked at this question and this question and this question (yes the question comes up a whole lot and so far I haven't found an answer that actually works), what should I do to avoid the knee-jerk duplicate response and encourage someone to look into the issue.

I thought of offering a reward, but I'm not sure if I can even do that for a question that has an accepted and upvoted answer.


NOTE: Someone tried to flag question this as a duplicate of the meta question I had already referenced below. I have already explained in detail why each of the suggested courses of action in the answers that question doesn't help. If you flag this as a dup again, I'll accept it, but realize that there is still no good answer.

As a meta aside: This is exactly the response I expect if I do as suggested and simply ask a new question that references the existing questions and say, "Those answers don't solve the problem." I don't HAVE any new information other than "it still doesn't work" and I am at a loss for how to get it. As I also mentioned I'm working on a MVCE, but creating a new Spring app that is complex enough to duplicate the problem will probably take me a week of my employer's time and I'm hoping that since others have already reported that the existing answers don't help, this should be right down Stack Overflow's sweet spot.


By the way to make this recursive (or at least meta meta), this very question you are looking at is a duplicate of this meta question, but the solutions offered to that question don't work for me:

  • Yes, I have tried all of the suggest answers.

  • No, I can't state clearly why the other answers don't work for me. If I knew that....

  • No, I don't know what is different about my scenario vs the one described in the other question. If I knew that...

  • Yes I checked my work.

  • Yes, the symptoms of the problem are exactly the same as those described in the other question. I'm assuming something about my environment is different from something that wasn't mentioned in the other question, but other than the version of Spring (included in my comment) I can't think what it might be.

I was really excited when I found the other question with an accepted answer -- up until the answer didn't work.

An also, I confess to not having created a MCVE. I'm trying, but this is Spring we are talking about here. I'm not sure it's possible to use the words "Spring" and "Minimal" in the same sentence.

8
  • 4
    "No, I can't state clearly why the other answers don't work for me. If I knew that...." You don't have to know why they don't work, you should just describe what happens when you try each solution (e.g. compile error, wrong output, etc.). Based on your comment however, I would say that a new question would be warranted, and would not be a duplicate
    – user000001
    Oct 2, 2017 at 19:43
  • Ask another question stating it is not a duplicate to <link other question> ?
    – JonH
    Oct 2, 2017 at 19:47
  • 2
    @JonH this is not a comment. I am a purple unicorn. Oct 2, 2017 at 20:08
  • 3
    If you aren't clear as possible in detailing why each of the answers didn't work (and saying they "didn't work" doesn't count), you'll end up being closed as a dupe.
    – user1228
    Oct 2, 2017 at 20:18
  • The property is supposed to be read from a .properties file and injected into an annotated member variable. If you define a default value it overrides the value from the properties file. If you don't you see the value from the properties file if it exists or an exception if the value does not exist in the property file. These symptoms are completely unchanged by any of the suggested solutions [note I already said this in my comment.] Oct 2, 2017 at 20:42
  • Other than single stepping through 10,000 lines of unfamiliar code that's been decompiled from a jar file (I'm guessing the number of lines here but I'll bet I'm in the right order of magnitude) I don't know how to get any more information. That's why I'm on Stack Overflow rather than heads-down in a debugger. Oct 2, 2017 at 20:43
  • I don't see any other alternative than asking new question with all information about what you've found/tried (as suggested in question you've mentioned and now linked as duplicate). Note that coming up with MCVE would likely be more reliable approach to solve the problem as it sounds like all obvious cases already covered and it would be more shot in the dark if someone had similar issue - chance that the person you are looking for will see you question is low and may take very long time. Oct 2, 2017 at 20:56
  • Why not ask it on the Spring forums? The answer you linked to is correct. Not much more can be done on SO to help you, asking some detailed debugging information specific to your setup is not really on-topic.
    – Oleg
    Oct 2, 2017 at 21:20

1 Answer 1

0
  1. Ask a new question
  2. In your question, link the question you found : Spring @Value annotated method, use default value when properties not available
  3. Explain why none of the answer in the linked question worked for you. Or how the problem seems different for you.

I can't think of a wiser course of action.

Not the answer you're looking for? Browse other questions tagged .