This InfoContributor exposes information related to Spring projects through actuator's info endpoint as part of the Enhanced Observability effort: https://github.com/spring-projects/spring-boot/issues/25476 When configured, it looks like this:

"spring": {
    "framework": {
        "version": "6.1.0"
    },
    "boot": {
        "version": "3.2.0"
    },
    "profiles": ["default"]
}

The feature can be enabled by setting: management.info.spring.enabled=true.

Comment From: wilkinsona

https://github.com/spring-projects/spring-boot/issues/22924 is related to this.

Comment From: mdeinum

Would it make sense to detect other used frameworks that can supply information as well? Like Spring Security, Spring Integration? Or maybe even provide a VersionInfo interface (or whatever it is) and that implementations can be auto-detected?

Comment From: jonatan-ivanov

@mdeinum In some of the cases, yes. E.g.: Spring Security seems possible, it has a similar class that tells you the version of it. But in other cases, not really: e.g.: Spring Data projects are versioned separately and as far as I know, the release train version is not available. Also, in case of Spring Cloud, the dependency is the other way: Boot does not depend on Cloud but Cloud depends on Boot, so here we will not be able to add the Cloud version but Cloud needs to add it (a VersionInfo interface can solve this issue though).

Comment From: mhalbritter

I like the idea of the portfolio project versions as an InfoContributor, but right now, it only shows the framework and the boot version. We should make this list more complete. I've put a "pending design work" label on it.

Comment From: wilkinsona

My feeling is that we should probably close this one. I agree with @mhalbritter that we should make the list of versions more complete. SBOM's are becoming increasingly popular and I think they are the right way to achieve that. An SBOM could be generated at build time using one of the existing build plugins and then, if desired, packaged in the application and exposed through an actuator endpoint.

Comment From: jonatan-ivanov

What do you think about providing information about the effective profiles?

"spring": {
    "profiles": ["default"]
}

Comment From: wilkinsona

The env endpoint already provides that information.

Comment From: jonatan-ivanov

Isn't activeProfiles under the env endpoint "just" provide the value of environment.getActiveProfiles()? If so, I'm not sure that's what I would need since that's not necessarily the "effective profile" that will be used.

For example, if I don't set the active profiles property but set spring.profiles.default, then environment.getActiveProfiles() will be empty and the profiles I set for default will be used. I think it would be useful to return the "effectively used profiles". Something like this (see in the PR):

this.profiles = ObjectUtils.isEmpty(environment.getActiveProfiles()) ? environment.getDefaultProfiles() : environment.getActiveProfiles();

Comment From: wilkinsona

Thanks, @jonatan-ivanov. Sorry, I'd missed the distinction you were making between effective and active. I think our best option here would be to add a new field to the env endpoint that shows the default profiles alongside the active profiles. I'd rather do that than change the meaning of the existing field.

I've opened https://github.com/spring-projects/spring-boot/issues/39245.