-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Voyager controllers replaced with RouterFunctions and common RouterFu…
…nctions refactoring
- Loading branch information
Showing
13 changed files
with
164 additions
and
187 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...sadv1r/spring/graphql/editor/graphiql/configuration/GraphiQlWebFluxAutoConfiguration.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package ru.sadv1r.spring.graphql.editor.graphiql.configuration; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.autoconfigure.AutoConfiguration; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.web.reactive.function.server.HandlerFunction; | ||
import org.springframework.web.reactive.function.server.RenderingResponse; | ||
import org.springframework.web.reactive.function.server.RouterFunction; | ||
import org.springframework.web.reactive.function.server.RouterFunctions; | ||
|
||
import static org.springframework.web.reactive.function.server.RequestPredicates.GET; | ||
|
||
@AutoConfiguration | ||
@EnableConfigurationProperties(GraphiqlProperties.class) | ||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) | ||
@ConditionalOnProperty(value = "spring.graphql.graphiql.enabled", havingValue = "true", matchIfMissing = true) | ||
public class GraphiQlWebFluxAutoConfiguration { | ||
|
||
@Bean | ||
@Order(-1) | ||
public RouterFunction<RenderingResponse> reactiveGraphiQlRouterFunction(GraphiqlProperties properties, | ||
@Value("${spring.graphql.path:/graphql}") String serverPath) { | ||
final HandlerFunction<RenderingResponse> handler = e -> RenderingResponse.create("graphiql") | ||
.modelAttribute("cdnHost", properties.getCdn().getHost()) | ||
.modelAttribute("serverPath", serverPath) | ||
.modelAttribute("query", properties.getQuery()) | ||
.modelAttribute("defaultEditorToolsVisibility", properties.getDefaultEditorToolsVisibility()) | ||
.modelAttribute("variables", properties.getVariables()) | ||
.modelAttribute("headers", properties.getHeaders()) | ||
.modelAttribute("plugins", properties.getPlugins()) | ||
.modelAttribute("stylePath", properties.getStylePath()) | ||
.build(); | ||
|
||
return RouterFunctions.route(GET(properties.getPath()), handler); | ||
} | ||
|
||
} |
41 changes: 0 additions & 41 deletions
41
...v1r/spring/graphql/editor/graphiql/configuration/GraphiQlWebFluxMvcAutoConfiguration.java
This file was deleted.
Oops, something went wrong.
This file contains 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
2 changes: 1 addition & 1 deletion
2
...esources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
ru.sadv1r.spring.graphql.editor.graphiql.configuration.GraphiQlWebFluxMvcAutoConfiguration | ||
ru.sadv1r.spring.graphql.editor.graphiql.configuration.GraphiQlWebFluxAutoConfiguration | ||
ru.sadv1r.spring.graphql.editor.graphiql.configuration.GraphiQlWebMvcAutoConfiguration |
This file contains 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
This file contains 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
36 changes: 0 additions & 36 deletions
36
...rter/src/main/java/ru/sadv1r/spring/graphql/editor/voyager/ReactiveVoyagerController.java
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
...arter/src/main/java/ru/sadv1r/spring/graphql/editor/voyager/ServletVoyagerController.java
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
.../java/ru/sadv1r/spring/graphql/editor/voyager/configuration/VoyagerAutoConfiguration.java
This file was deleted.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
...u/sadv1r/spring/graphql/editor/voyager/configuration/VoyagerWebFluxAutoConfiguration.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package ru.sadv1r.spring.graphql.editor.voyager.configuration; | ||
|
||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.autoconfigure.AutoConfiguration; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.core.annotation.Order; | ||
import org.springframework.web.reactive.function.server.HandlerFunction; | ||
import org.springframework.web.reactive.function.server.RenderingResponse; | ||
import org.springframework.web.reactive.function.server.RouterFunction; | ||
import org.springframework.web.reactive.function.server.RouterFunctions; | ||
|
||
import static org.springframework.web.reactive.function.server.RequestPredicates.GET; | ||
|
||
@AutoConfiguration | ||
@EnableConfigurationProperties(VoyagerProperties.class) | ||
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) | ||
@ConditionalOnProperty(value = "spring.graphql.voyager.enabled", havingValue = "true", matchIfMissing = true) | ||
public class VoyagerWebFluxAutoConfiguration { | ||
|
||
@Bean | ||
@Order(-1) | ||
public RouterFunction<RenderingResponse> reactiveVoyagerRouterFunction(VoyagerProperties properties, | ||
@Value("${spring.graphql.path:/graphql}") String serverPath) { | ||
final HandlerFunction<RenderingResponse> handler = e -> RenderingResponse.create("voyager") | ||
.modelAttribute("cdnHost", properties.getCdn().getHost()) | ||
.modelAttribute("serverPath", serverPath) | ||
.modelAttribute("displayOptions", properties.getDisplayOptions()) | ||
.modelAttribute("hideDocs", properties.isHideDocs()) | ||
.modelAttribute("hideSettings", properties.isHideSettings()) | ||
.modelAttribute("stylePath", properties.getStylePath()) | ||
.build(); | ||
|
||
return RouterFunctions.route(GET(properties.getPath()), handler); | ||
} | ||
|
||
} |
Oops, something went wrong.