1010import io .sentry .event .helper .ShouldSendEventCallback ;
1111import io .sentry .spring .SentryExceptionResolver ;
1212import io .sentry .spring .SentryServletContextInitializer ;
13- import org .springframework .beans .factory .annotation .Autowired ;
14- import org .springframework .boot .autoconfigure .condition .ConditionalOnClass ;
15- import org .springframework .boot .autoconfigure .condition .ConditionalOnMissingBean ;
16- import org .springframework .boot .autoconfigure .condition .ConditionalOnProperty ;
17- import org .springframework .boot .autoconfigure .condition .ConditionalOnWebApplication ;
13+ import org .springframework .boot .autoconfigure .condition .*;
1814import org .springframework .boot .context .properties .EnableConfigurationProperties ;
1915import org .springframework .boot .web .servlet .ServletContextInitializer ;
2016import org .springframework .context .annotation .Bean ;
@@ -58,6 +54,39 @@ public ServletContextInitializer sentryServletContextInitializer() {
5854 return new SentryServletContextInitializer ();
5955 }
6056
57+ /**
58+ * Initializes a {@link List<EventBuilderHelper>}.
59+ *
60+ * @return a new instance of {@link List<EventBuilderHelper>}.
61+ */
62+ @ Bean
63+ @ ConditionalOnMissingBean (EventBuilderHelper .class )
64+ public List <EventBuilderHelper > defaultEventBuilderHelpers () {
65+ return Collections .emptyList ();
66+ }
67+
68+ /**
69+ * Initializes a {@link List<EventSendCallback>}.
70+ *
71+ * @return a new instance of {@link List<EventSendCallback>}.
72+ */
73+ @ Bean
74+ @ ConditionalOnMissingBean (EventSendCallback .class )
75+ public List <EventSendCallback > defaultEventSendCallbacks () {
76+ return Collections .emptyList ();
77+ }
78+
79+ /**
80+ * Initializes a {@link List<ShouldSendEventCallback>}.
81+ *
82+ * @return a new instance of {@link List<ShouldSendEventCallback>}.
83+ */
84+ @ Bean
85+ @ ConditionalOnMissingBean (ShouldSendEventCallback .class )
86+ public List <ShouldSendEventCallback > defaultShouldSendEventCallbacks () {
87+ return Collections .emptyList ();
88+ }
89+
6190 /**
6291 * Initializes a {@link SentryClient}.
6392 *
@@ -67,9 +96,9 @@ public ServletContextInitializer sentryServletContextInitializer() {
6796 @ ConditionalOnMissingBean (SentryClient .class )
6897 @ ConditionalOnProperty (name = "sentry.init-default-client" , havingValue = "true" , matchIfMissing = true )
6998 public SentryClient sentryClient (SentryProperties properties ,
70- @ Autowired ( required = false ) List <EventBuilderHelper > eventBuilderHelpers ,
71- @ Autowired ( required = false ) List <EventSendCallback > eventSendCallbacks ,
72- @ Autowired ( required = false ) List <ShouldSendEventCallback > shouldSendEventCallbacks ) {
99+ List <EventBuilderHelper > eventBuilderHelpers ,
100+ List <EventSendCallback > eventSendCallbacks ,
101+ List <ShouldSendEventCallback > shouldSendEventCallbacks ) {
73102 String dsn = properties .getDsn () != null ? properties .getDsn ().toString () : null ;
74103
75104 SentryOptions sentryOptions = SentryOptions .from (createLookup (properties ), dsn , null );
0 commit comments