Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API to expose specification versions #762

Open
dblevins opened this issue Sep 28, 2023 · 5 comments
Open

API to expose specification versions #762

dblevins opened this issue Sep 28, 2023 · 5 comments

Comments

@dblevins
Copy link
Contributor

We're beginning to make more backwards incompatible changes to APIs and behavior, which is a totally fine evolution of the platform.

I think this means we owe it to users to allow them to reliably and portably determine which exact specification version the application might be running in so they can act accordingly. A great deal of people write libraries that are used in multiple applications and those applications typically span a few Jakarta EE versions. There really needs to be an easy API an application can make use of to tell them what spec version they're running in.

Before we get into proposals, what do you think about the goal?

In terms of proposals, we could do JNDI calls, system properties, etc. The JVM takes the system property approach. We could possibly do the same using the short names of each spec. I.e. something like:

  • jakarta.platform.version = 10.0
  • jakarta.core.version = 10.0
  • jakarta.servlet.version = 6.0
  • jakarta.pages.version = 3.1
  • jakarta.batch.version = 2.1
    ...
    etc

FYI all the short names are used in both these places:

The version would be just major+minor, no patch or service versions. The TCK of each spec would look for the system properties that relate to their spec. In whole, there would need to be a system property present for each spec the server implements. People would not only be able to use the system property to know what version is supported, but if there is support at all. For example, is MVC in the server? This is all information application developers can use to determine in code what kind of behavior they have.

@scottmarlow
Copy link
Contributor

scottmarlow commented Sep 29, 2023 via email

@starksm64
Copy link
Contributor

starksm64 commented Sep 30, 2023 via email

@keilw
Copy link
Member

keilw commented Sep 30, 2023 via email

@keilw
Copy link
Member

keilw commented Sep 30, 2023

Maybe something similar to the Spring Boot /info actuator: https://howtodoinjava.com/spring-boot/info-endpoint-custom-info/

@edburns
Copy link
Contributor

edburns commented Oct 31, 2023

Consider this comment.

It is better to use interface methods with default implementations. For example.

public interface WebProfile {

   static WebProfile instance() {
    ...
    }

   default VersionInfo annotations() {
      new VersionInfo(3, 0);
   }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants