Created
June 11, 2018 16:38
-
-
Save hmedkouri/32a4772265d22a8c8227eda5d2a01c08 to your computer and use it in GitHub Desktop.
Micronaut StackOverflowError when using Guava Eventbus
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.common.eventbus.EventBus | |
import com.google.common.eventbus.Subscribe | |
import io.micronaut.context.ApplicationContext | |
import spock.lang.Specification | |
import javax.inject.Inject | |
import javax.inject.Singleton | |
class EventBusSpec extends Specification { | |
void "try to reproduce the stack overflow error"(){ | |
expect: | |
ApplicationContext context = ApplicationContext.run() | |
context.getBean(Subscriber) | |
} | |
@Singleton | |
static class Subscriber { | |
static final EventBus eventBus = new EventBus("") | |
final Service service | |
@Inject | |
Subscriber(Service service) { | |
this.service = service | |
eventBus.register(this) | |
} | |
@Subscribe | |
void onEvent(String event){ | |
println event | |
} | |
} | |
@Singleton | |
static class Service { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment