https://kotlinlang.org logo
Title
s

Sourabh Rawat

05/21/2021, 8:11 AM
I am trying to test a grpc spring boot service. Getting
No qualifying bean of type 'org.lognet.springboot.grpc.autoconfigure.GRpcServerProperties'
What am I missing?
class CommonSupplyBasicIT2(private val gRpcServerProperties: GRpcServerProperties) : BehaviorSpec() {

    override fun extensions() = listOf(SpringExtension)

    private lateinit var channel: ManagedChannel

    private lateinit var commonSupplyService: CommonSupplyAPIGrpcKt.CommonSupplyAPICoroutineStub

    override fun beforeSpec(spec: Spec) {
        super.beforeSpec(spec)
        BlockHound.install() // Detect blocking calls
        channel = ManagedChannelBuilder
            .forAddress("localhost", gRpcServerProperties.runningPort)
            .usePlaintext()
            .build()
        commonSupplyService = CommonSupplyAPIGrpcKt.CommonSupplyAPICoroutineStub(channel)
    }

    override fun afterSpec(spec: Spec) {
        super.afterSpec(spec)
        channel.shutdownNow()
    }

}
I am able to autowire
GRpcServerProperties
with normal junit5 tests
t

thanksforallthefish

05/21/2021, 8:15 AM
you seem to lack
@SpringBootTest
on top of your class
s

Sourabh Rawat

05/21/2021, 8:17 AM
oh thank you!! stupid mistake of mine T.T