Я пытаюсь сделать Decorator в сварке, но сварка вернула ошибку. Я не понимаю, в чем моя ошибка. Я использовал тот же пример сварного шва «weld-se-numberguess» и я был создан декоратором, расширяющим игру.JAVA - WELD Ошибка декоратора
Set 18, 2015 3:41:02 PM org.jboss.weld.bootstrap.WeldStartup <clinit>
INFO: WELD-000900: 2.2.16 (Final)
Set 18, 2015 3:41:03 PM org.jboss.weld.bootstrap.WeldStartup startContainer
INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously.
Exception in thread "main" org.jboss.weld.exceptions.DefinitionException: WELD-001455: Decorator [class org.jboss.weld.environment.se.example.numberguess.GameDecorator] decorates [] with delegate type [Game] and delegate qualifiers [@Default] does not declare any decorated types.
at org.jboss.weld.bootstrap.Validator.validateDecorator(Validator.java:570)
at org.jboss.weld.bootstrap.ConcurrentValidator$3.doWork(ConcurrentValidator.java:96)
at org.jboss.weld.bootstrap.ConcurrentValidator$3.doWork(ConcurrentValidator.java:94)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
pom.xml
<dependencies>
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se</artifactId>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>javax.ejb-api</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
GameDecorator.java
@Decorator
public abstract class GameDecorator extends Game implements Serializable {
@Delegate
@Inject
Game game;
/**
*
*/
private static final long serialVersionUID = 9155583141751623258L;
// public GameDecorator(@Delegate @Any Game game) {
// }
@Override
public int getNumber() {
return 98;
}
}
bean.xml
<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" bean-discovery-mode="all">
<decorators>
<class>org.jboss.weld.environment.se.example.numberguess.GameDecorator</class>
</decorators>
</beans>
Можете ли вы добавить украшенный бобов типа игры? –