Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
908c7b5
moving jmh into libraries module
AbhinabKanrar Jun 5, 2017
4202dd3
refactoring jmh
AbhinabKanrar Jun 7, 2017
b42a5e5
Merge branch 'master' into master
zhendrikse Jun 7, 2017
34704c4
Update pom.xml
zhendrikse Jun 7, 2017
fc4a818
manual algorightm
AbhinabKanrar Jun 16, 2017
87351d7
with BM result
AbhinabKanrar Jun 17, 2017
75ca775
fix for space issue
AbhinabKanrar Jun 18, 2017
3a31078
Fixed indentation
zhendrikse Jun 18, 2017
d97b7b6
Merge branch 'master' into master
zhendrikse Jun 18, 2017
33082cf
change as per suggestion
AbhinabKanrar Jun 21, 2017
f32c5c0
Merge branch 'master' of https://github.com/AbhinabKanrar/tutorials
AbhinabKanrar Jun 21, 2017
59df78e
Merge branch 'master' into master
AbhinabKanrar Jun 21, 2017
21e6bb8
vavr either
AbhinabKanrar Jun 30, 2017
51b5052
adding unit test and othe rutilities
AbhinabKanrar Jul 1, 2017
b293b9b
adding concurrent module
AbhinabKanrar Jul 15, 2017
b17a7ac
concurrent package description
AbhinabKanrar Jul 15, 2017
885591c
concurrent package description
AbhinabKanrar Jul 15, 2017
1ae46ce
Update EitherUnitTest.java
AbhinabKanrar Jul 15, 2017
8aa9d5d
Merge branch 'master' into master
AbhinabKanrar Jul 15, 2017
36346f4
introducing lambda expression
AbhinabKanrar Jul 22, 2017
a001ed5
Merge branch 'master' into master
AbhinabKanrar Jul 22, 2017
7f8e5e2
jooby project
AbhinabKanrar Jul 29, 2017
ebb4c2c
Merge branch 'master' into master
AbhinabKanrar Jul 29, 2017
5488e9f
jooby project
AbhinabKanrar Jul 29, 2017
dd983c9
Merge branch 'master' of https://github.com/AbhinabKanrar/tutorials
AbhinabKanrar Jul 29, 2017
4457e5f
reducing employee bean content
AbhinabKanrar Jul 29, 2017
df91b6c
Merge branch 'master' into master
AbhinabKanrar Jul 29, 2017
c11501c
bootique module
AbhinabKanrar Aug 1, 2017
4530e3e
Merge branch 'master' of https://github.com/AbhinabKanrar/tutorials
AbhinabKanrar Aug 1, 2017
0882d25
bootique
AbhinabKanrar Aug 4, 2017
709267d
bootique
AbhinabKanrar Aug 5, 2017
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
11 changes: 11 additions & 0 deletions bootique/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
log:
level: warn
appenders:
- type: file
logFormat: '%c{20}: %m%n'
file: /home/logger.log

jetty:
context: /hello
connector:
port: 10001
50 changes: 50 additions & 0 deletions bootique/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>bootique-parent</artifactId>
<groupId>io.bootique.parent</groupId>
<version>0.12</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung.bootique</groupId>
<artifactId>bootique</artifactId>
<name>bootique</name>
<version>1.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.bootique</groupId>
<artifactId>bootique-test</artifactId>
<version>0.23</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.bootique.bom</groupId>
<artifactId>bootique-bom</artifactId>
<version>0.23</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<properties>
<main.class>com.baeldung.bootique.App</main.class>
</properties>
</project>

66 changes: 66 additions & 0 deletions bootique/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung.bootique</groupId>
<artifactId>bootique</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>bootique</name>
<url>http://maven.apache.org</url>

<properties>
<main.class>com.baeldung.bootique.App</main.class>
</properties>

<parent>
<groupId>io.bootique.parent</groupId>
<artifactId>bootique-parent</artifactId>
<version>0.12</version>
</parent>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.bootique.bom</groupId>
<artifactId>bootique-bom</artifactId>
<version>0.23</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>io.bootique.jersey</groupId>
<artifactId>bootique-jersey</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.bootique.logback</groupId>
<artifactId>bootique-logback</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.bootique</groupId>
<artifactId>bootique-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
42 changes: 42 additions & 0 deletions bootique/src/main/java/com/baeldung/bootique/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.baeldung.bootique;

import java.util.function.Supplier;

import com.baeldung.bootique.module.ModuleBinder;
import com.baeldung.bootique.router.IndexController;
import com.baeldung.bootique.router.SaveController;
import com.google.inject.Module;

import io.bootique.Bootique;
import io.bootique.jersey.JerseyModule;
import io.bootique.log.BootLogger;

public class App {

public static void main(String[] args) {
Module module = binder -> JerseyModule.extend(binder).addResource(IndexController.class)
.addResource(SaveController.class);
Bootique.app(args).module(module).module(ModuleBinder.class).bootLogger(new BootLogger() {
@Override
public void trace(Supplier<String> arg0) {
// ...
}

@Override
public void stdout(String arg0) {
// ...
}

@Override
public void stderr(String arg0, Throwable arg1) {
// ...
}

@Override
public void stderr(String arg0) {
// ...
}
}).autoLoadModules().exec();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.baeldung.bootique.module;

import com.baeldung.bootique.service.HelloService;
import com.baeldung.bootique.service.impl.HelloServiceImpl;
import com.google.inject.Binder;
import com.google.inject.Module;

public class ModuleBinder implements Module {

@Override
public void configure(Binder binder) {
binder.bind(HelloService.class).to(HelloServiceImpl.class);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.baeldung.bootique.module;

import com.google.inject.Module;

import io.bootique.BQModuleProvider;

public class ModuleProvider implements BQModuleProvider {

@Override
public Module module() {
return new ModuleBinder();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.baeldung.bootique.router;

import javax.ws.rs.GET;
import javax.ws.rs.Path;

@Path("/")
public class IndexController {

@GET
public String index() {
return "Hello, baeldung!";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.baeldung.bootique.router;

import javax.ws.rs.POST;
import javax.ws.rs.Path;

import com.baeldung.bootique.service.HelloService;
import com.google.inject.Inject;

@Path("/save")
public class SaveController {

@Inject
HelloService helloService;

@POST
public String save() {
return "Data Saved!";
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.baeldung.bootique.service;

public interface HelloService {

boolean save();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.baeldung.bootique.service.impl;

import com.baeldung.bootique.service.HelloService;

public class HelloServiceImpl implements HelloService {

@Override
public boolean save() {
return true;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.baeldung.bootique.module.ModuleProvider
29 changes: 29 additions & 0 deletions bootique/src/test/java/com/baeldung/bootique/AppTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.baeldung.bootique;

import static org.junit.Assert.assertEquals;

import org.junit.Rule;
import org.junit.Test;

import com.baeldung.bootique.service.HelloService;

import io.bootique.BQRuntime;
import io.bootique.test.junit.BQDaemonTestFactory;
import io.bootique.test.junit.BQTestFactory;

public class AppTest {

@Rule
public BQTestFactory bqTestFactory = new BQTestFactory();

@Rule
public BQDaemonTestFactory bqDaemonTestFactory = new BQDaemonTestFactory();

@Test
public void givenService_expectBoolen() {
BQRuntime runtime = bqTestFactory.app("--server").autoLoadModules().createRuntime();
HelloService service = runtime.getInstance(HelloService.class);
assertEquals(true, service.save());
}

}
6 changes: 1 addition & 5 deletions jooby/src/main/java/com/baeldung/jooby/bean/Employee.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ public class Employee {
String id;
String name;
String email;
String phone;
String address;

public Employee(String id, String name, String email, String phone, String address) {
public Employee(String id, String name, String email) {
super();
this.id = id;
this.name = name;
this.email = email;
this.phone = phone;
this.address = address;
}

}