You're right. Until (including) 1.0.0-RC1 a Service was registered using
@OsgiServiceProvider and the Qualifier for the injection-point was
@OsgiService.
This was changed in the Snapshot to the following
@Service
@Component
public class CdiServiceBean implements CdiService {
@Inject
@Service
private SomeOtherOsgiService service;
So, a OsgiService is registered with @Component + @Service while @Service
is also used as a Qualifier for the injection-point. In this case it works
because CdiServiceBean is a CDI-OsgiService. Using a Enterprise-Bean (e.g.
@ReguestScoped) the @Service annotation cannot be used.
Either I am missing something, or OSGi-Service-injection in plain cdi-beans
is not supported.
regards
Marc
Am Mittwoch, 5. Oktober 2016 21:57:06 UTC+2 schrieb Achim Nierbeck:
>
> Hi,
>
> I'm not sure but didn't the osgi service injection change with the
> 1.0.0-SNAPSHOT ?
> Could be another annotation now.
>
> regards, Achim
>
>
> 2016-10-05 18:33 GMT+02:00 Marc Schlegel <[email protected] <javascript:>
> >:
>
>> I am still trying to figure out how to use Pax-CDI with JSF in Pax-Web.
>>
>> *When I inject a OSGi-Service in a CDI-Bean I get a IllegalStateException*
>>
>> java.lang.IllegalArgumentException: Beans with @Service, @Component or
>> @Config injection points should be annotated with @Component
>>
>> @RequestScoped
>> @Named("loginController")
>> public class LoginController {
>>
>> private String username;
>> private String password;
>>
>> @Inject
>> @Service
>> private LoginService loginService;
>>
>> How would I inject an OSGi-Service in a scoped bean? I think that was
>> possible with version 0.13.0 by using
>>
>> @Inject @OsgiService
>> private LoginService loginService;
>>
>>
>> Should I file a bug or am I missing something?
>>
>> regards
>> Marc
>>
>> --
>> --
>> ------------------
>> OPS4J - http://www.ops4j.org - [email protected] <javascript:>
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "OPS4J" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
>
> Apache Member
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> blog <http://notizblog.nierbeck.de/>
> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>
> Software Architect / Project Manager / Scrum Master
>
>
--
--
------------------
OPS4J - http://www.ops4j.org - [email protected]
---
You received this message because you are subscribed to the Google Groups
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.