My beans.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="annotated">
</beans>
My service (backend - type EJB) looks like this:
import javax.inject.Inject;
import javax.transaction.Transactional;
@Default
@Transactional(Transactional.TxType.REQUIRED)
public class UserServiceImpl implements UserService {
@Inject
private UserDao userDao;
@Inject
private UserMapper mapper;
and @Named
annotated bean uses this (web):
import javax.inject.Inject;
import javax.inject.Named;
import org.omnifaces.cdi.ViewScoped;
@ViewScoped
@Named("indexMBean")
public class IndexMBean extends AbstractViewBean {
@Inject
private UserService userService;
Build was success, but deploy gives me this exception:
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type UserService with qualifiers @Default at injection point [BackedAnnotatedField] @Inject private hu.food.bean.IndexMBean.userService
how can I set the Default injection for UserService?
the log says:
2018-11-12 11:28:25,706 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."kaJava-ear-0.0.1-SNAPSHOT.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."kaJava-ear-0.0.1-SNAPSHOT.ear".WeldStartService: Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1728) at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556) at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378) at java.lang.Thread.run(Thread.java:748) Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type UserService with qualifiers @Default at injection point [BackedAnnotatedField] @Inject private hu.food.bean.IndexMBean.userService at hu.food.bean.IndexMBean.userService(IndexMBean.java:0)
<?xml ...
or<beans/>
? – pirho