出于测试目的,我设置了一个使用Weld SE和JUnit5的示例项目,由于某种原因,在我的测试类中,在初始化weld I之后,观察到由于某种原因,它的bean发现被禁用,这最终导致了这个错误: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Person with qualifiers @Default; 这是我的测试类: @EnableWeld
public class SimpleTestA {
@Inject
Person p;
@Test
p
我不太熟悉cdi或JUnit规则(实际上我刚刚发现它们),但是我尝试用库(基于)测试。我确切地说我的api不是基于UnboundId LDAP的!
这是我的代码:
@RunWith(CdiRunner.class)
public class LdapTest extends TestCase {
public static final Logger LOGGER = LoggerFactory.getLogger(LdapTest.class);
public static final String DOMAIN_DSN = "dc=my.domain";
假设RequestScope是活动的(使用cdi-unit的@InRequestScope)
给定的
package at.joma.stackoverflow.cdi;
public class Product {
public Product(String withValue){
this.value = withValue;
}
public String value;
}
将产品注入该活动请求范围
package at.joma.stackoverflow.cdi;
import javax.inject.Inject;
i
给定的
public class BeanContainer {
@Produces
Bean bean = new Bean();
}
及其替代办法:
@Alternative
public class BeanContainerAlt extends BeanContainer {
@Produces
int producerInt = 10;
}
比恩在哪里
public class Bean {
boolean didPostConstruct = false;
@PostConstruct
public void postConst
我刚刚将焊接版从2.4.4升级到3.0.1。在应用程序启动时,我面临以下错误,无法找到解决方案。我用的是焊接SE。
Sep 15, 2017 1:25:12 PM org.jboss.weld.xml.BeansXmlHandler error
WARN: WELD-001208: Error when validating file:/(...)/META-INF/beans.xml@7 against xsd. cvc-complex-type.2.4.a: Invalid content was found starting with element 'weld:scan'
我想使用DeltaSpike进行基于CDI的测试。我在我的应用程序中使用了大量的GroupedConversationScoped Beans,当我尝试测试它们时,我总是遇到这样的失败:
org.jboss.weld.context.ContextNotActiveException: WELD-001303: No active contexts for scope type org.apache.deltaspike.core.api.scope.GroupedConversationScoped
at org.jboss.weld.manager.BeanManagerImpl.getC