开发者

weld @Inject a interface

开发者 https://www.devze.com 2023-03-10 02:44 出处:网络
i\'m new to weld. I\'m setup a seam 3 project war packaged. I want to discover picketlink security management and in order to test his various mamanger (after setup the database and entity classes) i\

i'm new to weld. I'm setup a seam 3 project war packaged. I want to discover picketlink security management and in order to test his various mamanger (after setup the database and entity classes) i've created a controller (TestAction class) so:

@Named("testAction")
@ConversationScoped
public  class TestAction implements Serializable{
  private static final long serialVersionUID = 1L;

  @Inject
  PersistenceManager persistenceManager;


  public void createUser() throws IdentityException
  {


    persistenceManager.createUser("TEST_USER");
  }
}

My env is jboss 6 final.

On startup i got:

WELD-001408 Unsatisfied dependencies for type [PersistenceManager] with qualifiers
[@Any] at enter injection point [[field] @Inject @Any
com.mycompany.myproject.action.TestAction.persistenceManager]

PersistenceManager is an interface with a concrete clas开发者_JS百科s with a parameter (IdentitySesionImpl)

How can i Inject PersistenceManager? What is the meaning of WELD-001408?

Regards


I'm not sure to understand. do you want to use JPA persistence Manager or is it a class you created by your own ?

If it's a JPA persistence manager, you don't have to provide an implementation but to configure JPA in persistence.xml file.

If it's you interface and class, I encourage you to change their names beacause they are quite confusing. And you should check if your implementation is a valid CDI Bean : concrete class with no constructor or at least a default constructor without parameters.

0

精彩评论

暂无评论...
验证码 换一张
取 消