Yet again, this shows that Java desperately needs a properly module system to work in the
modern world!
On 2 Apr 2010, at 16:10, Dan Allen wrote:
Seam 3 module writers,
Be sure that if you are producing a common type for internal use, such as a
javax.naming.Context, that you qualify it to your module (or purpose). Otherwise, any
other module that provides that type will conflict with your module
(AmbigousResolutionException).
Here's an example:
@Produces
public Context getContext() throws NamingException
{
return new InitialContext();
}
Here's another:
public @Produces @ConversationScoped EntityManager getEntityManager()
{
return entityManager;
}
These should be qualified. In the first case, perhaps something like this for the foobar
module:
@Produces @org.jboss.seam.foobar.annotations.Module
public Context getContext() throws NamingException
{
return new InitialContext();
}
If the type is common, but your module is expected to produce it, then it's okay for
it to be unqualified (@Default qualifier). For example, the international module may be
expected to produce a java.util.Locale. The developer shouldn't use two international
modules, so this is fine. I would call this a @Default type which your module exports. It
would be good to provide this list in your documentation.
If you have any feedback or additional suggestions, feel free to comment.
Dan
--
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597
http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://www.google.com/profiles/dan.j.allen
_______________________________________________
seam-dev mailing list
seam-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/seam-dev