Questions tagged [weld]

Weld is the reference implementation (RI) for JSR-299: Java Contexts and Dependency Injection for the Java EE platform (CDI)

Weld is the reference implementation (RI) for JSR-299: Java Contexts and Dependency Injection for the Java EE platform (CDI)

See http://seamframework.org/Weld

592 questions
6
votes
2 answers

Using Seam in a single legacy WAR of an otherwise Weld-enabled EAR

We are using Wildfly 8.2.0.Final, Maven 2.2.1, Seam 2.2.0.GA, and Weld 2.2.6.Final. We have an EAR file with a legacy WAR, a new WAR, and a bunch of other modules. The legacy WAR relies on Seam, but the new WAR and the rest of the modules in the EAR…
mattalxndr
  • 9,143
  • 8
  • 56
  • 87
6
votes
2 answers

Using Weld with Dropwizard

I am trying to use Weld-SE for dependency injection in a dropwizard application. I can bootstrap Weld and inject in the Application class like so: public class App extends Application { @Inject NameService service; @Inject…
6
votes
3 answers

Checking if class is proxified with CDI 1.2

In CDI 1.2 there is a way to check if a class instance is proxified? I need this because I need to get the name of original class, not the proxy name. @Inject Bean bean; public void sysout() { // will print something like com.Bean$$Weld9239823 …
Otávio Garcia
  • 1,372
  • 1
  • 15
  • 27
6
votes
3 answers

WELD-001408 Unsatisfied dependencies for type ... with qualifiers [@Default] at injection point

I got a stupid problem when deploying my Java Application on JBoss. Before I changed my source code using an interface class everything was fine. So here is my problem: public interface FWInterface { public FWResult process(FWRequest fwRequest,…
PT_STAR
  • 505
  • 1
  • 4
  • 13
6
votes
1 answer

Jetty Embedded, Jersey 2, Weld

I'm using Jetty 9.1 and Jersey 2.5.1. Jersey has built-in support for Jetty, so I start my server like that: public static void main(String[] args) { URI baseUri = UriBuilder.fromUri("http://localhost/").port(8080).build(); ResourceConfig…
coffee_machine
  • 1,203
  • 14
  • 28
6
votes
2 answers

Is interceptor really disabled by default?

I ran into this confusion today. Quote from Weld's documentation (right under Section 9.3), By default, all interceptors are disabled. We need to enable our interceptor. We can do it using beans.xml descriptor of a bean archive. However, this…
JBT
  • 8,498
  • 18
  • 65
  • 104
6
votes
4 answers

Setting CDI conversation timeout globally

Is it possible to set conversation timeout globally for all conversation objects injected into @Named beans? I have several @ConversationScoped beans, e.g.: import javax.annotation.PostConstruct; import javax.enterprise.context.Conversation; import…
stasal
  • 315
  • 3
  • 11
5
votes
1 answer

Injecting @Dependent CDI bean into EJB causes memory leak

Testing memory leaks with creation of multiple @Dependent instances with WildFly 18.0.1 @Dependent public class Book { @Inject protected GlobalService globalService; protected byte[] data; protected String id; public Book() { …
Rustam
  • 1,397
  • 1
  • 13
  • 17
5
votes
0 answers

Cannot inject ExternalContext or RequestParam in CDI @RequestScoped managed Bean

Searching around the web I found that it should be possible to @Inject some convenient JSF Objects into CDI beans, these objects should be Produced by JSF and exposed via Qualifiers in javax.faces.annotation.* (like @RequestMap or…
jfer
  • 81
  • 6
5
votes
3 answers

Dependency injection through constructor does not work for EJB bean

My app is being deployed on to IBM WebSphere. I have a simple service and I'd like to know how dependency injection works in this case. // stateless EJB @Stateless public class UserService { private UserDAO userDAO; // btw, UserDAO is…
ikos23
  • 4,879
  • 10
  • 41
  • 60
5
votes
1 answer

Clean solution for eager CDI bean instantiation

Imagine the following simplified DI model: @ApplicationScoped public class A { private B b; @Inject public A(B b) { this.B = b; } } @ApplicationScoped public class B { private C c; @Inject public B(C c) { …
papiomytoglou
  • 53
  • 1
  • 4
5
votes
2 answers

How to use CDI into JAX-RS client

I have searched a while on SO and official documentation but I cannot found a way to use directly CDI injection into a JAX-RS client. I retrieve a client using the builder method and I want to register a WriterInterceptor (or any filter like…
Nicolas Henneaux
  • 11,507
  • 11
  • 57
  • 82
5
votes
0 answers

Multiple Contexts For Request Scope?

I am attempting to use Weld with Tomcat7 and Jersey, and in my log files I am seeing this: org.jboss.weld.exceptions.IllegalStateException: WELD-001304: More than one context active for scope type javax.enterprise.context.RequestScoped The…
El Guapo
  • 5,581
  • 7
  • 54
  • 82
5
votes
2 answers

Can I inject an JPA EntityManager using CDI and @PersistenceContext, like with Spring?

In Spring, I can inject an javax.persistence.EntityManager into a Spring bean using the annotation @javax.persistence.PersistenceContext, like this: @Service public class MyRepository { @PersistenceContext private EntityManager…
sleske
  • 81,358
  • 34
  • 189
  • 227
5
votes
2 answers

CDI session scoped bean not destroyed results in memory leakage

I have a question regarding the lifecycle of session scoped CDI beans. As far as I understand, a session scoped CDI bean is constructed by the container when the session starts and destroyed when the session ends. Before the bean is destroyed the…
steven.westside
  • 259
  • 2
  • 8