I've started using Guice within a Struts2 (v2.0.11.2) application.
Implicit bindings work fine. However, I can't seem to get Guice to
use my explicit bindings. Debugging I can see that the configure()
method of my Guice Module is never called, but I can't work out why.
I'd be grateful for any suggestions as to why this might be.
My Module is implemented as follows:
package com.mycompany.myproject
import com.google.inject.AbstractModule;
public class GuiceModule extends AbstractModule {
public void configure(){
bind(ImageManager.class).to(DefaultImageManager.class);
}
}
My Struts.xml looks like:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation"
value="false" />
<constant name="struts.devMode" value="true" />
<!-- Use Guice as the ObjectFactory for this application -->
<constant name="struts.objectFactory" value="guice" />
<constant name="guice.module"
value="com.mycompany.myproject.GuiceModule"/>
<include file="common.xml"/>
<!-- Add packages here -->
</struts>
When I try to run the action when I'm trying to inject an ImageManager
instance I get the following message
Binding to com.mycompany.myproject.mypackage.ImageManager not found.
No bindings to that type were found.
Thanks
Paul
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---