<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>avoid sharing of global variables using spring in liferay</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=39816654" />
  <subtitle>avoid sharing of global variables using spring in liferay</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=39816654</id>
  <updated>2026-04-06T15:26:19Z</updated>
  <dc:date>2026-04-06T15:26:19Z</dc:date>
  <entry>
    <title>avoid sharing of global variables using spring in liferay</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=39816653" />
    <author>
      <name>himanshu kaushik</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=39816653</id>
    <updated>2014-07-09T10:13:27Z</updated>
    <published>2014-07-09T10:13:27Z</published>
    <summary type="html">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. &lt;br /&gt;This prompted us to do small POC on independent spring code in which we used @Component and @Scope (value=&amp;#34;session&amp;#34;, 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.&lt;br /&gt;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.&lt;br /&gt;Hope that the issue has been made clear. Please suggest.</summary>
    <dc:creator>himanshu kaushik</dc:creator>
    <dc:date>2014-07-09T10:13:27Z</dc:date>
  </entry>
</feed>
