Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ private static Router initRouterByYAML(String location) throws Exception {

GrammarAutoGenerated grammar = new GrammarAutoGenerated();
BeanRegistryImplementation reg = new BeanRegistryImplementation(grammar);
router.setRegistry(reg);
reg.register("router", router);

getConfigDefinition(reg.parseYamlBeanDefinitions(router.getResolverMap().resolve(location), grammar))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import com.predic8.membrane.annot.beanregistry.AsyncBeanCollector;
import com.predic8.membrane.annot.beanregistry.BeanCollector;
import com.predic8.membrane.annot.beanregistry.BeanDefinition;
import com.predic8.membrane.annot.beanregistry.BeanRegistryImplementation;
import com.predic8.membrane.annot.yaml.*;
import com.predic8.membrane.core.config.spring.*;
import com.predic8.membrane.core.interceptor.kubernetes.*;
Expand Down Expand Up @@ -47,9 +46,9 @@ public class KubernetesWatcher {
public KubernetesWatcher(DefaultRouter router) {
this.router = router;
this.grammar = new GrammarAutoGenerated();
var br = new BeanRegistryImplementation(grammar);
var br = router.getRegistry();
br.register("router", router);
this.beanRegistry = new AsyncBeanCollector(br);
this.beanRegistry = new AsyncBeanCollector((BeanCollector) br);
}

public void start() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ void pathParameterRouting() {
// @formatter:off
given()
.when()
.get("http://localhost:2000/fruits/7")
.get("http://localhost:2000/fruits/12")
.then()
.statusCode(200)
.body("id", equalTo(7))
.body("id", equalTo(12))
.body("name", notNullValue())
.body("modified_at", notNullValue());
// @formatter:on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ void consoleLogs() {
// @formatter:off
given()
.when()
.get("http://localhost:2000/fruits/7")
.get("http://localhost:2000/fruits/12")
.then()
.statusCode(200)
.body("id", equalTo(7))
.body("id", equalTo(12))
.body("name", notNullValue())
.body("modified_at", notNullValue());
// @formatter:on
Expand All @@ -57,8 +57,8 @@ void consoleLogs() {
String console = out.toString();
System.out.println(console);
assertTrue(console.contains("INFO LogInterceptor"));
assertTrue(console.contains("Requested /fruits/7"));
assertTrue(console.contains("Rewritten /shop/v2/products/7"));
assertTrue(console.contains("Requested /fruits/12"));
assertTrue(console.contains("Rewritten /shop/v2/products/12"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Try:
#
# curl http://localhost:2000/fruits/7
# curl http://localhost:2000/fruits/12

api:
port: 2000
Expand Down
2 changes: 1 addition & 1 deletion distribution/tutorials/advanced/30-Path-Rewriting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# Try:
#
# curl http://localhost:2000/fruits/7
# curl http://localhost:2000/fruits/12
#
# Observe the log output.

Expand Down
Loading