Sample project showing the issue
A breif explanation of the behaviour and sample code:
There are 2 beans defined in Spring: Hello and Goodby.
Goodby is declared as lazy-init="true".
Each bean prints a message when they are instantiated.
When the application starts, and the Spring context gets loaded, only Hello bean gets instantiated as can be seen by the message ">>> Hello bean instantiated. <<<" that gets printed.
So far so good, but when I invoke the Hello bean through dwr, the Goodby bean gets instantiated (which shouldn't, as it is lazy) as can be seen by the message being printed ">>> Goodby bean instantiated. <<<".
This happens as soon as I point my browser to the web app since the index.html uses Hello.js. This also happens if you point your browser to http://localhost:8080/DWRSpringLazyInit/dwr/test/Hello or http://localhost:8080/DWRSpringLazyInit/dwr/.