Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
avoid sharing of global variables using spring in liferay
We are facing one issue while using spring @controller in liferay. While we are using global variables in our controller, the value of global variable is getting shared among all session i.e. for every new request across browser. This is due to its singleton nature.
This prompted us to do small POC on independent spring code in which we used @Component and @Scope (value="session", proxyMode=ScopedProxyMode.TARGET_CLASS) on the class we are using as global variable and by autowiring the global variable. This helped in resolving our issue.
But the same when implemented with liferay is proving to be complete waste. As the null values of properties of DTO (my global variable) are being received but not changing while we are operating on it in controller.
Hope that the issue has been made clear. Please suggest.
This prompted us to do small POC on independent spring code in which we used @Component and @Scope (value="session", proxyMode=ScopedProxyMode.TARGET_CLASS) on the class we are using as global variable and by autowiring the global variable. This helped in resolving our issue.
But the same when implemented with liferay is proving to be complete waste. As the null values of properties of DTO (my global variable) are being received but not changing while we are operating on it in controller.
Hope that the issue has been made clear. Please suggest.