Timeline for Springframework constructor-arg
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 14, 2013 at 14:28 | history | edited | nicholas.hauschild | CC BY-SA 3.0 | Correct code issue. |
| Sep 30, 2011 at 4:00 | comment | added | nicholas.hauschild | I understand your example, but Spring is not necessary to create an instance of Test in this case. Here, you should create Test using the new operator just as you have shown: Test test = new Test(var1, var2); | |
| Sep 29, 2011 at 19:57 | comment | added | user12121 | "Main" class defines 2 variables. "Test" class is instantiated from "Main" class and should pass those 2 variables to "Test" class. How can I acheive this using Spring. For Ex: Main Class: int var1 = getValueFromDatabase(1); int var2 = getValueFromDatabase(2); Test test = new Test(var1, var2); | |
| Sep 29, 2011 at 19:49 | comment | added | nicholas.hauschild | That is not what you use Spring for. Dependency injection is about setting your dependencies up outside of code. What is it that you are trying to do? | |
| Sep 29, 2011 at 19:33 | comment | added | user12121 | var1 and var2 values should be passed from Main class. Those are not constant values. Can I configure that in applicationContext.xml file? | |
| Sep 29, 2011 at 19:24 | history | edited | nicholas.hauschild | CC BY-SA 3.0 | added 26 characters in body |
| Sep 29, 2011 at 19:18 | history | answered | nicholas.hauschild | CC BY-SA 3.0 |