ratpack with google guice (#1542)
* rest with spark java * 4 * Update Application.java * indentation changes * spring @requestmapping shortcuts * removing spring requestmapping and pushing spring-mvc-java * Joining/Splitting Strings with Java and Stream API * adding more join/split functionality * changing package name * testcase change * adding webutils * adding testcase for WebUtils and ServletRequestUtils * adding testcase * spring-security-stormpath * adding ratpack module * adding pom.xml * adding following modules with updated testcase : DB, Filter, Json * adding spring-boot custom banner tutorial * changing banner format in plain text * Delete banner.txt~ * Delete b.txt~ * CORS in JAX-RS * ratpack with google guice
This commit is contained in:
31
ratpack/src/main/java/com/baeldung/guice/Application.java
Normal file
31
ratpack/src/main/java/com/baeldung/guice/Application.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.baeldung.guice;
|
||||
|
||||
import com.baeldung.guice.config.DependencyModule;
|
||||
import com.baeldung.guice.service.DataPumpService;
|
||||
import com.baeldung.guice.service.impl.DataPumpServiceImpl;
|
||||
|
||||
import ratpack.guice.Guice;
|
||||
import ratpack.server.RatpackServer;
|
||||
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
|
||||
RatpackServer
|
||||
.start(server -> server.registry(Guice.registry(bindings -> bindings.module(DependencyModule.class)))
|
||||
.handlers(chain -> chain.get("randomString", ctx -> {
|
||||
DataPumpService dataPumpService = ctx.get(DataPumpService.class);
|
||||
ctx.render(dataPumpService.generate().length());
|
||||
})));
|
||||
|
||||
// RatpackServer.start(server -> server
|
||||
// .registry(Guice
|
||||
// .registry(bindings -> bindings.bindInstance(DataPumpService.class, new DataPumpServiceImpl())))
|
||||
// .handlers(chain -> chain.get("randomString", ctx -> {
|
||||
// DataPumpService dataPumpService = ctx.get(DataPumpService.class);
|
||||
// ctx.render(dataPumpService.generate());
|
||||
// })));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user