Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [rest-dev] [External] : Re: Jakarta Rest 3.2?
  • From: Jan Supol <jan.supol@xxxxxxxxxx>
  • Date: Thu, 18 Jan 2024 16:42:07 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mzXWwy+JaIp7VCkq1dj0IRRfaGes6uf+VFD0R7Plstw=; b=U1N0BrSHfUTHrr0gw6IlmMGSAWxYyfCnzrRRsYqiDa5c1993wWgCR0s/u/2IjX/Vqfa8GkkYa39UEDiv3uPJQM0/Zwug9Uklp9Qwn2i5SQ9UZwII+Vvw7QXp1nBs6cZIupURq6jiNNxYB0XLPEfXgwTDK4BhIwLZmrLHEgykuouLHe2ORsgvlrDoXizYvWuTqRPoDtIgi/vhXJ3Wm0esNQtfmXv5UCI71T+2TLGgtr5jfPPwuKrbzQHBNIkynJkR05B2aezQKNCViyTTRmTrZH6qzXYARzxhf4haRqNYuG/7LjTGpq6vx85XvKIF+PaF3DkWXDUa0BoUVB3l0CQ5jQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R/SAYsEZHm6FpZTzPQ6CLjvKaAurKWXWS8GTUsa8XPdKtSh6KGVsoT2HCPnyMeLZG1W3OIowsNNhvocGTXmOAYs297yRcXrXHjKL2IxZzf95iN1DFiurTkfkdtdzh01tuxgECAghAkE5GsRwx/3sUlV/NsGeQ9kTOJ1oFo1+xaEl4gkiK1hqDGvNQGTlyFtVx6Ee++LM7oP3Ez5L/VsUzIJXcAk7WV/ikV07UNekD2Ic/h2fmDZbXQE0DUexe0dXCgTlNJvszvPVK1+j1yVaXS3KC5+naMv3ti0jefUDZ2NM7ncHRtm12SvleA10AyIAn+9vGyb4uoeGjVBCsRA1vw==
  • Delivered-to: rest-dev@xxxxxxxxxxx
  • List-archive: <https://www.eclipse.org/mailman/private/rest-dev/>
  • List-help: <mailto:rest-dev-request@eclipse.org?subject=help>
  • List-subscribe: <https://www.eclipse.org/mailman/listinfo/rest-dev>, <mailto:rest-dev-request@eclipse.org?subject=subscribe>
  • List-unsubscribe: <https://www.eclipse.org/mailman/options/rest-dev>, <mailto:rest-dev-request@eclipse.org?subject=unsubscribe>
  • Msip_labels:
  • Thread-index: AQHaSX780gspP1t6bUOVzu3hVSu9tLDfk3iT
  • Thread-topic: [rest-dev] [External] : Re: Jakarta Rest 3.2?

 
Are you suggesting: 
  • need to support @Inject by the 3.1 injection wherever the deprecated @Context would be replaced by @Inject 
I'm not a CDI expert, but I think this should be doable. My implementation idea was to treat the ContextResolver's as CDI producers. 
I do not think CDI allows for injecting of parametrized beans. ContextResolver's injection should be deprecated. But we have a method on Providers to get the parametrized ContextResolver, and that's fine.
  • in JBoss (or any application server), you won't be able to use both injection modules at the same time, so only the deprecated injection will be included (to keep the backward compatibility)
There is a good chance I'm missing something here, but we already do this so I'm not sure how it will be a problem. Where I can see it being an issue is with constructor and method injection. However, we could have a hard rule along the lines of "Your resource or provider must use either use CDI injection for methods and constructors or use the deprecated @Context injection for methods and constructors". 
I'd expect you to be doing the similar things we do in Jersey, i.e. having your own injection framework and having CDI proxies into your injection framework for the RestEasy beans. But having this CDI proxy bean is quite a different thing from having the real CDI beans for pure CDI injection only. In other words, you cannot have on classpath one ReastEasy module that creates an injection bean for let's say @Context Configuration and another module for creating a real CDI bean for @Inject Configuration. 

The hard rule you mentioned still won't be enough, for instance, if there is a provider with @ApplicationScoped, it will be registered by the 3.1 injection as well as by the new CDI injection and the provider would be twice in CDI.

  • hence the CDI injection won't be testable by the tck running atop the application server
Or are you suggesting:
  •  teach CDI to understand the @Context and have CDI as the main injection framework
This is something I've thought about looking at TBH. Though that's an implementation detail. I know it's possible to do as this is what Quarkus does. 
Quarkus possibly does this with Weld, but with pure CDI, it won't be possible, IMO. So, the Spec should not expect that, and neither should the TCK tests.
 
One obvious catch to all of this is the client side. That said, we've got this issue whether we do a 3.2 or a 4.0. Client side injection is just not going to work without a CDI container.

Thank you for mentioning the Client. The client should not support the injection in CDI, IMO. In theory, you could have infinite clients, that is infinite number of Configuration beans that could be injected into the clients. It is not possible to use a finite number of qualifiers to distinct infinite number of client beans, not mentioning the server side Configuration bean being in the same CDI container.

It is implementable with a high effort and Weld, but the question is whether this messing up with Weld should be enforced by the Spec if CDI is not enough for it.

Back to the top