diff --git a/msf4j/pom.xml b/msf4j/pom.xml
new file mode 100644
index 000000000000..f691d746b74b
--- /dev/null
+++ b/msf4j/pom.xml
@@ -0,0 +1,32 @@
+
+
+
+ org.wso2.msf4j
+ msf4j-service
+ 2.6.0
+
+ 4.0.0
+
+ com.baeldung.msf4j
+ msf4j
+ 0.0.1-SNAPSHOT
+ WSO2 MSF4J Microservice
+
+
+ com.baeldung.msf4j.msf4jintro.Application
+
+
+
+ org.wso2.msf4j
+ msf4j-spring
+ 2.6.1
+
+
+ org.wso2.msf4j
+ msf4j-mustache-template
+ 2.6.1
+
+
+
+
\ No newline at end of file
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4japi/Application.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4japi/Application.java
new file mode 100644
index 000000000000..c4cf136536b2
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4japi/Application.java
@@ -0,0 +1,11 @@
+package com.baeldung.msf4j.msf4japi;
+
+import org.wso2.msf4j.MicroservicesRunner;
+
+public class Application {
+ public static void main(String[] args) {
+ new MicroservicesRunner()
+ .deploy(new MenuService())
+ .start();
+ }
+}
\ No newline at end of file
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4japi/Meal.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4japi/Meal.java
new file mode 100644
index 000000000000..d17a7a103430
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4japi/Meal.java
@@ -0,0 +1,20 @@
+package com.baeldung.msf4j.msf4japi;
+
+public class Meal {
+ private String name;
+ private Float price;
+
+ public Meal(String name, Float price) {
+ this.name = name;
+ this.price = price;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Float getPrice() {
+ return price;
+ }
+
+}
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4japi/MenuService.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4japi/MenuService.java
new file mode 100644
index 000000000000..4f880a13934b
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4japi/MenuService.java
@@ -0,0 +1,78 @@
+package com.baeldung.msf4j.msf4japi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import com.google.gson.Gson;
+
+@Path("/menu")
+public class MenuService {
+
+ private List meals = new ArrayList();
+
+ public MenuService() {
+ meals.add(new Meal("Java beans",42.0f));
+ }
+
+ @GET
+ @Path("/")
+ @Produces({ "application/json" })
+ public Response index() {
+ return Response.ok()
+ .entity(meals)
+ .build();
+ }
+
+ @GET
+ @Path("/{id}")
+ @Produces({ "application/json" })
+ public Response meal(@PathParam("id") int id) {
+ return Response.ok()
+ .entity(meals.get(id))
+ .build();
+ }
+
+
+ @POST
+ @Path("/")
+ @Consumes("application/json")
+ @Produces({ "application/json" })
+ public Response create(Meal meal) {
+ meals.add(meal);
+ return Response.ok()
+ .entity(meal)
+ .build();
+ }
+
+ @PUT
+ @Path("/{id}")
+ @Consumes("application/json")
+ @Produces({ "application/json" })
+ public Response update(@PathParam("id") int id, Meal meal) {
+ meals.set(id, meal);
+ return Response.ok()
+ .entity(meal)
+ .build();
+ }
+
+ @DELETE
+ @Path("/{id}")
+ @Produces({ "application/json" })
+ public Response delete(@PathParam("id") int id) {
+ Meal meal = meals.get(id);
+ meals.remove(id);
+ return Response.ok()
+ .entity(meal)
+ .build();
+ }
+}
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4jintro/Application.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4jintro/Application.java
new file mode 100644
index 000000000000..dc4a060056b0
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4jintro/Application.java
@@ -0,0 +1,11 @@
+package com.baeldung.msf4j.msf4jintro;
+
+import org.wso2.msf4j.MicroservicesRunner;
+
+public class Application {
+ public static void main(String[] args) {
+ new MicroservicesRunner()
+ .deploy(new SimpleService())
+ .start();
+ }
+}
\ No newline at end of file
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4jintro/SimpleService.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4jintro/SimpleService.java
new file mode 100644
index 000000000000..bcb52859b5b8
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4jintro/SimpleService.java
@@ -0,0 +1,21 @@
+package com.baeldung.msf4j.msf4jintro;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+
+@Path("/")
+public class SimpleService {
+
+ @GET
+ public String index() {
+ return "Default content";
+ }
+
+ @GET
+ @Path("/say/{name}")
+ public String say(@PathParam("name") String name) {
+ return "Hello " + name;
+ }
+
+}
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/Application.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/Application.java
new file mode 100644
index 000000000000..2a5232a7e605
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/Application.java
@@ -0,0 +1,10 @@
+package com.baeldung.msf4j.msf4jspring;
+
+import org.wso2.msf4j.spring.MSF4JSpringApplication;
+
+public class Application {
+
+ public static void main(String[] args) {
+ MSF4JSpringApplication.run(Application.class, args);
+ }
+}
\ No newline at end of file
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/configuration/PortConfiguration.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/configuration/PortConfiguration.java
new file mode 100644
index 000000000000..c3313fc3b111
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/configuration/PortConfiguration.java
@@ -0,0 +1,15 @@
+package com.baeldung.msf4j.msf4jspring.configuration;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.wso2.msf4j.spring.transport.HTTPTransportConfig;
+
+@Configuration
+public class PortConfiguration {
+
+ @Bean
+ public HTTPTransportConfig http() {
+ return new HTTPTransportConfig(9090);
+ }
+
+}
\ No newline at end of file
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/domain/Meal.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/domain/Meal.java
new file mode 100644
index 000000000000..99de0abc4ce4
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/domain/Meal.java
@@ -0,0 +1,20 @@
+package com.baeldung.msf4j.msf4jspring.domain;
+
+public class Meal {
+ private String name;
+ private Float price;
+
+ public Meal(String name, Float price) {
+ this.name = name;
+ this.price = price;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Float getPrice() {
+ return price;
+ }
+
+}
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/repositories/MealRepository.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/repositories/MealRepository.java
new file mode 100644
index 000000000000..4d9e54348e24
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/repositories/MealRepository.java
@@ -0,0 +1,37 @@
+package com.baeldung.msf4j.msf4jspring.repositories;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.springframework.stereotype.Component;
+import com.baeldung.msf4j.msf4jspring.domain.Meal;
+
+@Component
+public class MealRepository {
+
+ private List meals = new ArrayList();
+
+ public MealRepository() {
+ meals.add(new Meal("Salad", 4.2f));
+ meals.add(new Meal("Litre of cola", 2.99f));
+ }
+
+ public void create(Meal meal) {
+ meals.add(meal);
+ }
+
+ public void remove(Meal meal) {
+ meals.remove(meal);
+ }
+
+ public Meal find(int id) {
+ return meals.get(id);
+ }
+
+ public List findAll() {
+ return meals;
+ }
+
+ public void update(int id, Meal meal) {
+ meals.set(id, meal);
+ }
+}
\ No newline at end of file
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/resources/MealResource.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/resources/MealResource.java
new file mode 100644
index 000000000000..9c617257cb26
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/resources/MealResource.java
@@ -0,0 +1,47 @@
+package com.baeldung.msf4j.msf4jspring.resources;
+
+import java.util.Collections;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.wso2.msf4j.template.MustacheTemplateEngine;
+
+import com.baeldung.msf4j.msf4jspring.services.MealService;
+
+@Component
+@Path("/meal")
+public class MealResource {
+
+ @Autowired
+ private MealService mealService;
+
+ @GET
+ @Path("/")
+ public Response all() {
+ Map map = Collections.singletonMap("meals", mealService.findAll());
+ String html = MustacheTemplateEngine.instance()
+ .render("meals.mustache", map);
+ return Response.ok()
+ .type(MediaType.TEXT_HTML)
+ .entity(html)
+ .build();
+ }
+
+ @GET
+ @Path("/{id}")
+ @Produces({ "text/xml" })
+ public Response meal(@PathParam("id") int id) {
+ return Response.ok()
+ .entity(mealService.find(id))
+ .build();
+ }
+
+}
diff --git a/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/services/MealService.java b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/services/MealService.java
new file mode 100644
index 000000000000..fd6a51999967
--- /dev/null
+++ b/msf4j/src/main/java/com/baeldung/msf4j/msf4jspring/services/MealService.java
@@ -0,0 +1,27 @@
+package com.baeldung.msf4j.msf4jspring.services;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.baeldung.msf4j.msf4jspring.domain.Meal;
+import com.baeldung.msf4j.msf4jspring.repositories.MealRepository;
+
+@Service
+public class MealService {
+ @Autowired
+ private MealRepository mealRepository;
+
+ public Meal find(int id) {
+ return mealRepository.find(id);
+ }
+
+ public List findAll() {
+ return mealRepository.findAll();
+ }
+
+ public void create(Meal meal) {
+ mealRepository.create(meal);
+ }
+}
diff --git a/msf4j/src/main/resources/application.properties b/msf4j/src/main/resources/application.properties
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/msf4j/src/main/resources/templates/meals.mustache b/msf4j/src/main/resources/templates/meals.mustache
new file mode 100644
index 000000000000..f4bdfaccf9d9
--- /dev/null
+++ b/msf4j/src/main/resources/templates/meals.mustache
@@ -0,0 +1,13 @@
+
+
+ Meals
+
+
+
+
Today's Meals
+ {{#meals}}
+
{{name}}: {{price}}$
+ {{/meals}}
+
+
+