Yes I do see the log (catalina.out) shows 

                                 IAccount: DEFINED
                              IAuthService: DEFINED

And what makes me confused is that the log also shows that the IAccount is 
created when invoking AuthService.java

[DEBUG] AppModule.IAccount Creating service 'IAccount'.
[AuthService.java] accountDAO is null?<Proxy for 
Account(org.example.domain.IAccount)> //printed by System.out.println

But when it comes to execute RdbmsLogin.java, the '@private IAccount 
accountDAO' in RdbmsLogin becomes null because I use System.out.println() to 
print the object accountDAO (accountDAO.findUserByAccount(new User("-1", 
account, "", password));) and the result is as follow:

[RdbmsLogin.java] accountDAO is null? null

The flow of execution is

Login.java -> IAuthService.java/ AuthService.java -> RdbmsLogin.java 

in AuthService and Rdbmslogin both contain '@Inject private IAccount 
accountDAO' annotation; but the accountDAO in AuthService is not null and I can 
execute the function e.g. findUserByAccount without a problem. Unfortunately, 
when it execute accountDAO in RdbmsLogin, then the accountDAO is null. (This is 
just for comparison so I put two Inject annotation in AuthService and 
RdbmsLogin classes)

Also, if I remove IAuthService/ AuthService, directly calling RdbmsLogin.java 
from Login.java shows the accountDAO ('@Inject private IAccount accountDAO') in 
RdbmsLogin.java is still null.  (This execution flow should be Login.java -> 
RdbmsLogin.java )

The AppModule.java contains the binding clauses 

public class AppModule {
        public static void bind(ServiceBinder binder) {
                binder.bind(IAuthService.class, AuthService.class);
                binder.bind(IAccount.class, Account.class);
        }
...
}    

I think I may do something wrong, but I completely am not aware of it. Is there 
anything I miss or misconfigure?

Thanks in advice.

--- On Mon, 3/8/09, Juan E. Maya <[email protected]> wrote:

> From: Juan E. Maya <[email protected]>
> Subject: Re: Tapestry 5 IoC binding interface with impl problem
> To: "Tapestry users" <[email protected]>
> Date: Monday, 3 August, 2009, 7:44 PM
> Do u see the DAO being created when
> the application goes up? Tapestry
> does a very good job informing all the services that are
> configured.
> If it's not in the log then u r not binding the service.
> 
> There r 2 ways to bind services in a module:
> public static void bind(ServiceBinder binder) {
>    binder.bind(Interface.class,
> Impl.class);
> }
> 
> or
>  public static Interface buildServiceName()
>   {
>      return new InteraceImpl();
>   }
> 
> 
> I really didn't get what u were trying to do in the first
> email.
> ApplicationStateCreator<IAccount> account =
>                
>        new
> ApplicationStateCreator<IAccount>(){
>                
>            
>    public IAccount create() {
>                
>                
>        return new AccountDAO();
>                
>            
>    }
>                
>        };
> 
>            
>    configuration.add(IAccount.class, new
> ApplicationStateContribution("session", account));
> 
> 
> in what method of ur App module is that code?
> 





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to