Questions tagged [jboss-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). CDI is the Java standard for dependency injection and contextual lifecycle management, a Java Community Process (JCP) specification that integrates cleanly with the Java EE platform. Any Java EE 6-compliant application server provides support for JSR-299 (even the web profile).

http://seamframework.org/Weld

See also

393 questions
19
votes
1 answer

Is there an equivalent in CDI(WELD) to build definitions (as done in Guice modules) and then create an Injector?

I like the way Guice makes it fairly straight forward to manually create your own modules each with their own bindings done in code. CDI on the other hand seems to rely more on magic rather than programmatic access to sest bindings. Am i wrong or…
mP.
  • 18,002
  • 10
  • 71
  • 105
17
votes
2 answers

CDI Application and Dependent scopes can conspire to impact garbage collection?

We're starting to experiment with implementing our backend services using CDI. The scenario is this: EJB with @Startup is started when EAR deployed. An ApplicationScoped bean is injected onto this: @ApplicationScoped public class JobPlatform { …
Ben Kirby
  • 904
  • 2
  • 11
  • 29
17
votes
4 answers

CDI Ambiguous dependencies

I have a @SessionScoped @Named bean with a @Producer method for a user object: @Named @SessionScoped public class UserBean implements Serializable { //... @Named @Produces @LoggedIn @SessionScoped public MyUser getCurrentUser() {return…
Thor
  • 6,607
  • 13
  • 62
  • 96
16
votes
5 answers

How to inject String constants easily with Weld?

We have a situation where we provide an external configuration in form of a Map to our running programs. I have found that JSR-330 Dependency Injection gives a much cleaner way to use that configuration map in the code instead of passing the map…
Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
14
votes
3 answers

What is the difference between @Inject and @PersistenceContext?

In a project using JPA, I commonly use @Inject EntityManager em; in order to obtain such an object. I saw that many code snippets in the web instead use: @PersistenceContext EntityManager em; What is the difference between these options? My code…
Thiago Chaves
  • 9,218
  • 5
  • 28
  • 25
13
votes
3 answers

JBoss Weld + java.lang.OutOfMemoryError: PermGen space

I've just switched to Weld to make use of CDI JSF 2 Beans + conversation scope. Here's my maven dependency : org.jboss.weld.servlet weld-servlet
Bertie
  • 17,277
  • 45
  • 129
  • 182
13
votes
5 answers

Bean discovery problems when using weld-se with Gradle application plugin

I am building a Gradle-based Java SE application built on top of Hibernate as my ORM of choice. My plan is to use weld-se to be able to use CDI annotations for injections of EntityManagers throughout the application. Based on the common…
AdrianoKF
  • 2,891
  • 1
  • 25
  • 31
12
votes
3 answers

Can the classpath scanning be controlled in Weld?

I was playing with Weld-SE (Java SE) and noticed that if there are a lot of JARs in the classpath, the JVM startup time runs into several seconds. Isn't there a way to specify/restrict the scan path as a package pattern or path pattern like in…
Ashwin Jayaprakash
  • 2,168
  • 24
  • 29
12
votes
3 answers

Injecting a Spring bean using CDI @Inject

I'm trying to inject a bean defined in a Spring context into a CDI managed component but I'm not successful. The bean is not injected, instead a new instance gets created each time the injection should be performed. My environment is Tomcat 7 with…
Christian Seifert
  • 2,780
  • 5
  • 29
  • 45
12
votes
2 answers

CDI beans inside .jar are not found by the container (Unsatisfied dependencies)

I have created a Java project to serve as a lib to other projects, reducing code duplication between projects. This lib project is exported to jar to be included in Web projects (WAR, not EAR). In Web projects (where these classes are being removed)…
Renan Baggio
  • 411
  • 1
  • 4
  • 11
12
votes
5 answers

Differences between Java EE 6 CDI Implementations

I've looked at JBoss' Weld Reference Implementation of JSR-299 Contexts and Dependency Injection, and I wanted to know how others CDI implementations compare to each other. Specifically, I know about Weld, Resin CanDI (by Caucho), and Apache…
user265863
11
votes
7 answers

View Scope in CDI Weld

I want to use the @ViewScoped - scope in my application for the backing beans of some web pages. Also I use CDI to inject the dependecies into the backing beans. However, when I use a backing bean annotated like…
Balu123
  • 111
  • 1
  • 3
11
votes
1 answer

Using CDI (Weld) in Tomcat with simple POJO classes

After 2 days of debugging and trying I have no other idea than asking you for a solution. I want to use CDI (on JEE6) in a Tomcat WebApp with only simple plain old java objects (yet). As far as I know it is simply possible to inject POJO java…
Bert Speckels
  • 357
  • 2
  • 4
  • 14
11
votes
1 answer

CDI - what is the correct bean.xml format?

I have a question about the correct format and usage of the bean.xml file. In my projects I typically used this content for my bean.xml files (no explizit bean declaration used):
Ralph
  • 4,500
  • 9
  • 48
  • 87
11
votes
2 answers

When is a @Dependent scoped CDI bean destroyed, if you obtain that bean via Provider.get()?

I am struggling to understand the effective lifecycle of a @Dependent scoped bean in both CDI 1.0 and CDI 1.1. My experiments so far have lead me to the following conclusions: A @Dependent scoped bean is not proxied. No @PreDestroy method is…
Chris Rankin
  • 256
  • 1
  • 3
  • 10
1
2
3
26 27