Skip to content

Commit

Permalink
Merge pull request #2031 from Netflix/fix/2030
Browse files Browse the repository at this point in the history
qualify expected RequestMappingHandlerProvider
  • Loading branch information
iparadiso authored Oct 10, 2024
2 parents fad2cbd + 8643c4f commit 4e6100e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ open class DgsSpringGraphQLAutoConfiguration {

@Bean
@Dgs
open fun dgsWebDataBinderFactory(adapter: ObjectProvider<RequestMappingHandlerAdapter>): WebDataBinderFactory =
ServletRequestDataBinderFactory(listOf(), adapter.ifAvailable?.webBindingInitializer)
open fun dgsWebDataBinderFactory(
@Qualifier("requestMappingHandlerAdapter") adapter: ObjectProvider<RequestMappingHandlerAdapter>,
): WebDataBinderFactory = ServletRequestDataBinderFactory(listOf(), adapter.ifAvailable?.webBindingInitializer)

@Bean
open fun requestHeaderMapResolver(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,16 @@ import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguratio
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.boot.test.context.TestConfiguration
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.graphql.data.method.annotation.QueryMapping
import org.springframework.graphql.execution.SchemaReport
import org.springframework.http.MediaType
import org.springframework.stereotype.Component
import org.springframework.stereotype.Controller
import org.springframework.test.web.servlet.MockMvc
import org.springframework.test.web.servlet.post
import org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter
import java.util.function.Consumer

@SpringBootTest(
Expand All @@ -48,6 +51,7 @@ import java.util.function.Consumer
GraphQlAutoConfiguration::class,
GraphQlWebMvcAutoConfiguration::class,
WebMvcAutoConfiguration::class,
DgsSpringGraphQlSmokeTest.TestWebConfiguration::class,
],
properties = [
"dgs.graphql.schema-locations=classpath:/dgs-spring-graphql-smoke-test.graphqls",
Expand Down Expand Up @@ -146,4 +150,13 @@ class DgsSpringGraphQlSmokeTest {
}
}
}

@Configuration
open class TestWebConfiguration {
@Bean
open fun extraAdapter(): RequestMappingHandlerAdapter {
// to produce multiple beans to verify DGS injects the right one
return RequestMappingHandlerAdapter()
}
}
}

0 comments on commit 4e6100e

Please sign in to comment.