Questions tagged [jsr330]

JSR 330: Dependency Injection for Java

Specification: JSR 330

62 questions
2
votes
3 answers

Dependency injection with Spring (JSR 330 annotations) in WebSphere 7 is not working

I have an enterprise application built with Java 6, Spring Framework 3.1.2 and Mule-ESB 3.3.0, among other libraries not related to this question. Our beans and services are all declared with @Named and @Inject JSR-330 annotations, respectively for…
2
votes
1 answer

JSR-330 support in Picocontainer : @Inject ... @Named("xxx)

We have found code like private String string = "Not injected."; @Inject public void setString(@Named("s") String s) { this.string = s; } (utilitzing JSR-330 annotations) to be very useful to pass in a string value for "s". We would like to…
Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
1
vote
1 answer

How to tell JSF 2.0 in Glassfish to instantiate an CDI @Alternative to a ?

We have a JSF 2.0 application running under Glassfish 3.1.1 which has been moved forward from JSF 1. This mean that I have a faces-config.xml saying OnlineBeanHandler
Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
1
vote
1 answer

Trying to use JSR330ScopeMetadataResolver with Spring boot without success

I am trying to retrofit Spring DI into an existing application using Spring Boot. I want to use JSR-330 annotations instead of Spring's. I would like to make prototype scope the default so I don't have to use non-JSR-330 scope @Scope("prototype")…
1
vote
1 answer

Is there a JSR-330 equivalent of Spring's @Bean or Guice's @Provides annotation?

I tried using @Named annotation on methods that create a bean, but that doesn't seem to work. Couldn't find any question here or a blog that confirms this. Reading the description at jcp.org, I don't see any relationship b/w beans and dependency…
goelakash
  • 2,502
  • 4
  • 40
  • 56
1
vote
1 answer

What is the default bean scope if we use @Inject with @Component?

I know the default bean scope is singleton when we use @Autowired with @Component. But what if we use JSR-330's @Inject with spring's @Component (without using @Scope or @Singleton)?
sunilks23
  • 15
  • 5
1
vote
0 answers

Simple Java field injection with Micronaut what's the missing step(s)?

I am not sure yet if I'm on the wrong track or not. There is an example on the Micronaut Getting Started page for a V8 Engine and injecting a Vehicle. Defining Beans (often used Engine interface example) With that example in mind. What is the…
will
  • 4,799
  • 8
  • 54
  • 90
1
vote
2 answers

Java - Inject bean only in super constructor without field @Autowired

I am dealing with a design situation and I am not sure how to solve it or if I am doing anything wrong with my micro design. public abstract class A implements SomeFrameworkInterface { private final Param1 a1; @Inject private Param2 a2; …
1
vote
1 answer

Threaded Beans doesn't get Environment @Autowired to them in Spring when using JSR330 Provider

Hope the Question is self explanatory ClassA.java @Component @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public class ClassA implements InterB { private static int counter=0; private int objectid = 0; @Autowired InterA abcd; …
Crystal Paladin
  • 579
  • 5
  • 26
1
vote
0 answers

JSR 330 javax.inject.Provider didn't inject org.springframework.core.env.Environment in @Autowired field

I was using Provider to create prototype beans(with @Autowired fields) in a for loop But it seems, Provider is not playing well with Spring Framework Whenever I try to execute Provider get() method, the Spring Autowired Environment Bean is not…
Crystal Paladin
  • 579
  • 5
  • 26
1
vote
1 answer

JSR-330 @Scope and Spring Don't Match

The java doc for the JSR-330 Scope annotation states "uses the instance for one injection, and then forgets it" implying that the instance is of scope prototype and the Singleton annotation is intended to create the singleton that is the default…
peekay
  • 1,259
  • 2
  • 25
  • 49
1
vote
1 answer

Guice 3 in Struts2

I'm trying to integrate Guice 3 into my Struts application. This is what I did : Interface: public interface PersonDAO{ void addPerson(String username); } Implementation: @Singleton public Class PersonDAOImpl implements PersonDAO{ void…
picard
  • 11
  • 1
1
vote
1 answer

NoSuchBeanDefinitionException when injecting javax.inject.Provider to constructors using Spring

I'm using constructor-based dependency injection to inject a javax.inject.Provider to a service. With Spring Framework (4.2.5), NoSuchBeanDefinitionException will be thrown saying "No qualifying bean of type [T] found for dependency. Why is T…
Roger Suen
  • 51
  • 6
1
vote
1 answer

JSR303's primitive and iterable primitive validator

Is it somehow possible to implement a custom validator which handles both T and Iterable objects, where T is either primitive type or object? The goal is to implement only a single ConstraintValidator object instead of two: *ConstraintValidator…
nKognito
  • 6,297
  • 17
  • 77
  • 138
1
vote
2 answers

Switching among Spring, Guice, Weld or other DI implementations

I am writing a framework on top of it where other teams develop applications. I want to provide Dependency Injection as part of it. I am making developers uses JSR 330 annotations and my framework can work on DI. Still i have the following…
naveen
  • 124
  • 9