You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are 2 ways of doing dependency injection in Spring, either annotations on the classes to be inject with @Component and friends, or via @Configuration classes with @Bean methods.
It seems like some of the spring glowroot config explicitly looks for @Component annotation, which means that beans injected with @Bean methods aren't traced. Example code:
public class FooService {
@Scheduled(fixedDelay = 100)
public void fooSchedule() {
System.out.println("Hi");
}
}
...
@Configuration
public class FooConfig {
@Bean fooService() {
return new FooService();
}
}
...
@Component
public class BarService {
@Scheduled(fixedDelay = 100)
public void barSchedule() {
System.out.println("good morning");
}
}
Only scheduled tasks from BarService would appear in glowroot under 'Background' transactions. The scheduled method in FooService is ignored.
The text was updated successfully, but these errors were encountered:
but it didn't capture anything. For now I'm going to change my code to use @Component based injection instead; but this has the downside it is less flexible than @Bean based injection; since that can be used to inject any class without modifying the source.
There are 2 ways of doing dependency injection in Spring, either annotations on the classes to be inject with
@Component
and friends, or via@Configuration
classes with@Bean
methods.It seems like some of the spring glowroot config explicitly looks for
@Component
annotation, which means that beans injected with@Bean
methods aren't traced. Example code:Only scheduled tasks from BarService would appear in glowroot under 'Background' transactions. The scheduled method in FooService is ignored.
The text was updated successfully, but these errors were encountered: