1111import org .springframework .context .annotation .Configuration ;
1212
1313import javax .servlet .ServletRequestListener ;
14+ import java .util .Map ;
1415
1516/**
1617 * If spring-boot is loaded, add configuration specific to Spring Boot
@@ -26,17 +27,33 @@ class SpringBootConfiguration {
2627 * Add a callback to add the version of Spring Boot used by the application.
2728 */
2829 @ Bean
29- Callback springBootVersionCallback () {
30+ Callback springBootVersionErrorCallback () {
3031 Callback callback = new Callback () {
3132 @ Override
3233 public void beforeNotify (Report report ) {
33- report . addToTab ( "device" , "springBootVersion" , SpringBootVersion . getVersion ( ));
34+ appendSpringBootRuntimeVersion ( Diagnostics . retrieveRuntimeVersionsMap ( report . getDevice () ));
3435 }
3536 };
3637 bugsnag .addCallback (callback );
3738 return callback ;
3839 }
3940
41+ @ Bean
42+ BeforeSendSession springBootVersionSessionCallback () {
43+ BeforeSendSession beforeSendSession = new BeforeSendSession () {
44+ @ Override
45+ public void beforeSendSession (SessionPayload payload ) {
46+ appendSpringBootRuntimeVersion (Diagnostics .retrieveRuntimeVersionsMap (payload .getDevice ()));
47+ }
48+ };
49+ bugsnag .addBeforeSendSession (beforeSendSession );
50+ return beforeSendSession ;
51+ }
52+
53+ private void appendSpringBootRuntimeVersion (Map <String , Object > runtimeVersions ) {
54+ runtimeVersions .put ("springBoot" , SpringBootVersion .getVersion ());
55+ }
56+
4057 /**
4158 * The {@link com.bugsnag.servlet.BugsnagServletContainerInitializer} does not work for Spring Boot, need to
4259 * register the {@link BugsnagServletRequestListener} using a Spring Boot
0 commit comments