I have the following spring wired scala class with pseudo code.
@Service class Something { @Value("${some.property}") val someString : String
However, this will not work, because someString is part of the body of the constructor, and spring cannot connect to the values ββuntil it executes the constructor.
How can I connect to @Value so that it works, and is not terrible (my current solution with a custom constructor containing all the values ββI need, just does not feel "scala" and looks awful.
Edit: To clarify, my current solution is this:
@Service class Something { @Autowired def this(@Value("${some.prop}") prop : String) { this()
I just think it looks ugly and feels that there is a better way. I also do not like to create these secondary constructors when I prefer to use it in the main constructor.
Edit 2: To clarify, I was hoping there was a way to do something like this:
@Service class Something(@Value("${some.property}") string : String) {
Because it looks a lot more elegant. I just can't get it to work :)
source share