I'd like to add to this something I just discovered about deferred
binding and "precedence" when multiple bindings are defined. Building
on the example above, say you have an alerter, LibAlerter, defined in
a JAR whose gwt.xml file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<module>
<inherits name="com.google.gwt.user.User"/>
<source path='dbtl/'/>
<replace-with class="org.dbtl.LibAlerter">
<when-type-is class="org.dbtl.Alerter"/>
</replace-with>
</module>
Now say you include this JAR in some web project with an entry point,
plus its own implementation of the Alerter interface called
WebAlerter. Its gwt.xml file looks like this (note the comments):
<?xml version="1.0" encoding="UTF-8"?>
<module>
<inherits name="com.google.gwt.user.User"/>
<!--inherits name="org.Dbtl"/--> <!-- placing the inherits
directive here results in WebAlerter being bound -->
<entry-point class="org.dbt.client.MainEntryPoint"/>
<!-- Do not define servlets here, use web.xml -->
<replace-with class="org.dbt.client.WebAlerter">
<when-type-is class="org.dbtl.Alerter"/>
</replace-with>
<inherits name="org.Dbtl"/> <!-- placing the inherits directive
here results in LibAlerter being bound -->
</module>
So in the case that multiple bindings are defined for the same
interface, GWT seems to simply replace an existing binding with any
new one it encounters while parsing directives from top to bottom.
> I wanted to post a very simple example of GWTdeferredbindingas I