<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/">

<channel>
	<title>microservices Archives - Manish Sanger</title>
	<atom:link href="https://www.manishsanger.com/tag/microservices/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.manishsanger.com/tag/microservices/</link>
	<description>Java, J2EE, Spring Framework, application security,big data,database,design patterns,hibernate,j2ee,java,jdbc,micro-services,mongodb,multithreading,nosql</description>
	<lastBuildDate>Fri, 06 Apr 2018 13:23:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>
	<item>
		<title>Introduction to Spring Boot</title>
		<link>https://www.manishsanger.com/introduction-to-spring-boot/</link>
					<comments>https://www.manishsanger.com/introduction-to-spring-boot/#respond</comments>
		
		<dc:creator><![CDATA[manishsanger]]></dc:creator>
		<pubDate>Fri, 06 Apr 2018 13:22:13 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[java 8]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[microservices]]></category>
		<category><![CDATA[Spring]]></category>
		<guid isPermaLink="false">https://www.manishsanger.com/?p=372</guid>

					<description><![CDATA[<p>What is Spring Boot? Spring is a popular Java-based framework for building web and enterprise grade application. spring framework provides various modern features via its various projects. Spring team created Spring Boot project to create standalone, production-ready spring based executable applications. Most of the spring boot application requires minimal spring configuration. Why Spring Boot? In [&#8230;]</p>
<p>The post <a href="https://www.manishsanger.com/introduction-to-spring-boot/">Introduction to Spring Boot</a> appeared first on <a href="https://www.manishsanger.com">Manish Sanger</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>What is Spring Boot?</strong><br />
Spring is a popular Java-based framework for building web and enterprise grade application. spring framework provides various modern features via its various projects.<br />
Spring team created Spring Boot project to create standalone, production-ready spring based executable applications. Most of the spring boot application requires minimal spring configuration.</p>
<p><strong>Why Spring Boot?</strong><br />
In a traditional monolithic approach for developing web/RESTful application, a WAR is created and deployed on a web server like: Tomcat, Jboss, IBM WebSphere etc.<br />
From a microservices point of view, we need to develop services as executable, self-contained JAR files with an embedded HTTP listener.</p>
<p><strong>Spring Boot features:</strong></p>
<ol>
<li style="list-style-type: none;">
<ol>
<li><strong>Self-Contained web server:</strong> We can easily embed HTTP listeners for the web application. We can easily create a self-contained HTTP server using embedded tomcat, jetty etc.</li>
<li><strong>Standalone application:</strong> We can create a standalone executable application. It has SpringApplication class which provides the convenient way to bootstrap a spring application which can be started from the main method just by calling static method SpringApplication.run().</li>
<li><strong>Externalized configuration:</strong> It allows us to externalize the configuration so that we can work with the same application in various environments. We can use YAML files to externalize the configuration.</li>
<li><strong>YAML Support:</strong> It provides support for YAML configuration by default.</li>
<li><strong>Application Properties:</strong> It provides a rich set of application properties, for example: server-port, application-name and many more.</li>
<li><strong>Actuator:</strong> It provides production readiness by actuators such as metrics and health check.</li>
<li><strong>Type-safe configuration:</strong> It also provides a strong type-safe way to handle the configuration by allowing the developer to create a bean and populating it with the property value from a configuration file using annotation.</li>
<li><strong>Logging:</strong> It provides out of the box logging for all internal logging. Logback is provided by default without any additional configuration, which can be altered if needed.</li>
<li><strong>Security:</strong> It provides the feature of enabling the basic security by using the spring boot started security. It enables the basic security by default, which can be further enhanced to utilize the full strength of Spring security.</li>
</ol>
</li>
</ol>
<p><strong>Related Articles:</strong><br />
<a href="https://www.manishsanger.com/getting-started-with-spring-boot/"><strong>Getting started with Spring Boot, Create your first REST API application</strong></a></p>
<p>The post <a href="https://www.manishsanger.com/introduction-to-spring-boot/">Introduction to Spring Boot</a> appeared first on <a href="https://www.manishsanger.com">Manish Sanger</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.manishsanger.com/introduction-to-spring-boot/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Getting started with Spring Boot, Create your first REST API application</title>
		<link>https://www.manishsanger.com/getting-started-with-spring-boot/</link>
					<comments>https://www.manishsanger.com/getting-started-with-spring-boot/#respond</comments>
		
		<dc:creator><![CDATA[manishsanger]]></dc:creator>
		<pubDate>Fri, 06 Apr 2018 12:50:47 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[java 8]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[microservices]]></category>
		<category><![CDATA[Spring]]></category>
		<guid isPermaLink="false">https://www.manishsanger.com/?p=364</guid>

					<description><![CDATA[<p>Spring Boot is been created for Rapid development. In this article will go through the steps to create first basic REST API using Spring Boot. We will see the more advanced version of this application in upcoming articles on microservices. Prerequisite: 1. Maven 3.X 2. Java 1.8/1.7 Getting Started &#8211; Step by Step guide The [&#8230;]</p>
<p>The post <a href="https://www.manishsanger.com/getting-started-with-spring-boot/">Getting started with Spring Boot, Create your first REST API application</a> appeared first on <a href="https://www.manishsanger.com">Manish Sanger</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Spring Boot is been created for Rapid development. In this article will go through the steps to create first basic REST API using Spring Boot. We will see the more advanced version of this application in upcoming articles on microservices.</p>
<p><span style="text-decoration: underline;"><strong>Prerequisite:</strong></span></p>
<p>1. Maven 3.X<br />
2. Java 1.8/1.7</p>
<p><span style="text-decoration: underline;"><strong>Getting Started &#8211; Step by Step guide</strong></span></p>
<p>The best way to bootstrap your Spring Boot projects is to use <a href="https://start.spring.io/" target="_blank" rel="noopener">Spring Initializr</a></p>
<p>It allows you to bootstrap various type of Spring Boot application from a simple web UI. You can select various available libraries from UI as per your requirement.</p>
<p>There are various option to generate, you can choose from Maven/Gradle project, with Java/Kotlin/Groovy and appropriate spring boot version. We will be using Maven, Java and Spring Boot 2.0.0 here.</p>
<p>Define group, artifact, name &amp; description of the application on the UI.</p>
<p>Click on &#8220;Switch to the full version&#8221; at the bottom left to see the list all available library options to be included in the project. For this article, I have selected the following as this is just a basic article to get started with Spring Boot.</p>
<p><strong>Web:</strong><br />
-Web<br />
-Jersey(JAX-RS)</p>
<p><strong>Ops:</strong><br />
-Actuator</p>
<p>Click on &#8220;Generate Project&#8221; button at the bottom of the screen to download bootstrap project with Spring Boot.</p>
<div id="attachment_365" style="width: 808px" class="wp-caption alignnone"><a href="https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-Initializr.png"><img fetchpriority="high" decoding="async" aria-describedby="caption-attachment-365" class="size-full wp-image-365" src="https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-Initializr.png" alt="Spring Initializr- Spring Boot, bootstrap your first REST API application" width="798" height="581" srcset="https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-Initializr.png 798w, https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-Initializr-300x218.png 300w, https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-Initializr-768x559.png 768w" sizes="(max-width: 798px) 100vw, 798px" /></a><p id="caption-attachment-365" class="wp-caption-text">Spring Initializr- Spring Boot, bootstrap your first REST API application</p></div>
<p>Import the project in your favorite IDE &#8211; Eclipse, IntelliJ Idea, STS or any other. I am using IntelliJ Idea on Mac OSX.</p>
<p>Project Structure will look like as follows:</p>
<div id="attachment_366" style="width: 310px" class="wp-caption alignnone"><a href="https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-boot-project-structure.png"><img decoding="async" aria-describedby="caption-attachment-366" class="size-full wp-image-366" src="https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-boot-project-structure.png" alt="Spring boot - REST API project structure" width="300" height="359" srcset="https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-boot-project-structure.png 300w, https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-boot-project-structure-251x300.png 251w" sizes="(max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-366" class="wp-caption-text">Spring boot &#8211; REST API project structure</p></div>
<p>Here is pom.xml dependencies, downloaded from Spring Initializr.</p>
<div id="attachment_367" style="width: 461px" class="wp-caption alignnone"><a href="https://www.manishsanger.com/wp-content/uploads/2018/04/rest-api-dependencies.png"><img decoding="async" aria-describedby="caption-attachment-367" class="size-full wp-image-367" src="https://www.manishsanger.com/wp-content/uploads/2018/04/rest-api-dependencies.png" alt="Spring Boot REST API - maven dependencies" width="451" height="322" srcset="https://www.manishsanger.com/wp-content/uploads/2018/04/rest-api-dependencies.png 451w, https://www.manishsanger.com/wp-content/uploads/2018/04/rest-api-dependencies-300x214.png 300w" sizes="(max-width: 451px) 100vw, 451px" /></a><p id="caption-attachment-367" class="wp-caption-text">Spring Boot REST API &#8211; maven dependencies</p></div>
<p>spring-boot-starter-web &#8211; Starter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded container.</p>
<p>spring-boot-starter-actuator &#8211; Actuator provides production readiness of the application by monitoring our application, gathering metrics, understanding traffic, state of database etc. Will see actuator in more details in my next article.</p>
<p>Here is the Application file, which has the main method to run the Spring Boot application to make it executable:</p>
<pre><code class="java">@SpringBootApplication<br />
public class SpringbootdemoApplication {<br />
public static void main(String[] args) {<br />
SpringApplication.run(SpringbootdemoApplication.class, args);<br />
}<br />
}<br />
</code></pre>
<p>Create a Rest Controller, to create your first REST endpoint. Here is the code:</p>
<pre><code class="java">@RestController<br />
@RequestMapping(value = "/", produces = MediaType.APPLICATION_JSON_VALUE)<br />
public class HelloController {</p>
<p>@RequestMapping("/")<br />
public ResponseEntity&lt;Response&lt;List&gt;&gt; index() {<br />
HttpHeaders headers = new HttpHeaders();<br />
List listData = new ArrayList&lt;&gt;();<br />
listData.add("This is a First REST API with Spring boot");<br />
listData.add("Test2");</p>
<p>return new ResponseEntity&lt;&gt;(new Response&lt;&gt;(HttpStatus.OK.value(),<br />
"First Spring Boot REST API is working", listData), HttpStatus.OK);<br />
}<br />
}<br />
</code></pre>
<p>I create a class named Response to convert data to JSON and define a proper response format. This is not required, but I always prefer to have a class like this as it easy to format/standardize your response and pass HTTP status code &amp;message to variety of API consumers.</p>
<pre><code class="java">@JsonInclude(value = Include.NON_EMPTY)<br />
public class Response {</p>
<p>private int status;<br />
private String message;<br />
private T data;</p>
<p>public Response(int status, String message, T data) {<br />
super();<br />
this.status = status;<br />
this.message = message;<br />
this.data = data;<br />
}</p>
<p>public Response() {<br />
super();<br />
}</p>
<p>public int getStatus() {<br />
return status;<br />
}</p>
<p>public String getMessage() {<br />
return message;<br />
}</p>
<p>public T getData() {<br />
return data;<br />
}<br />
}<br />
</code></pre>
<p>You can also use lombok project (<a href="https://projectlombok.org/" target="_blank" rel="noopener">https://projectlombok.org/</a>), if you don&#8217;t want to write/generate getters &amp; setters.</p>
<p>That&#8217;s it, now we are ready to launch our first sample Spring Boot REST API project.</p>
<p>Go to Terminal and use the following commands to run the application.<br />
<pre><code class="bash">mvn clean install<br />
java -jar springbootdemo-0.0.1-SNAPSHOT.jar<br />
</code></pre>
<p>You can also run from your IDE. I am using IntelliJ Idea, so I can run it from IDE itself.</p>
<p>Once the run is complete, you can access it on http://localhost:8080/ or via postman. We haven’t made any configuration changes to it will run on localhost and default port 8080.</p>
<p>Here is the response:</p>
<div id="attachment_368" style="width: 451px" class="wp-caption alignnone"><a href="https://www.manishsanger.com/wp-content/uploads/2018/04/API-Response.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-368" class="size-full wp-image-368" src="https://www.manishsanger.com/wp-content/uploads/2018/04/API-Response.png" alt="Spring Boot - REST API Response" width="441" height="141" srcset="https://www.manishsanger.com/wp-content/uploads/2018/04/API-Response.png 441w, https://www.manishsanger.com/wp-content/uploads/2018/04/API-Response-300x96.png 300w" sizes="auto, (max-width: 441px) 100vw, 441px" /></a><p id="caption-attachment-368" class="wp-caption-text">Spring Boot &#8211; REST API Response</p></div>
<p>You can access Actuator Health and Info as follows:<br />
http://localhost:8080/actuator/health<br />
http://localhost:8080/actuator/info</p>
<p>The post <a href="https://www.manishsanger.com/getting-started-with-spring-boot/">Getting started with Spring Boot, Create your first REST API application</a> appeared first on <a href="https://www.manishsanger.com">Manish Sanger</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.manishsanger.com/getting-started-with-spring-boot/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<enclosure url="https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-Initializr.png" length="76611" type="image/png"/><media:content url="https://www.manishsanger.com/wp-content/uploads/2018/04/Spring-Initializr.png" width="798" height="581" medium="image" type="image/png"/>	</item>
		<item>
		<title>Microservices &#8211; An Introduction</title>
		<link>https://www.manishsanger.com/microservices-an-introduction/</link>
					<comments>https://www.manishsanger.com/microservices-an-introduction/#respond</comments>
		
		<dc:creator><![CDATA[manishsanger]]></dc:creator>
		<pubDate>Mon, 02 Apr 2018 13:48:30 +0000</pubDate>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[microservices]]></category>
		<guid isPermaLink="false">https://www.manishsanger.com/?p=358</guid>

					<description><![CDATA[<p>In recent years, micro-service is getting popularity and is a buzz word in IT/Software industry. Micro-services are an architectural style or an approach to build IT systems as a set of business capabilities that are autonomous, self-contained, and loosely coupled. Its used to achieve agility, the speed of delivery and scaling. Many organizations such as [&#8230;]</p>
<p>The post <a href="https://www.manishsanger.com/microservices-an-introduction/">Microservices &#8211; An Introduction</a> appeared first on <a href="https://www.manishsanger.com">Manish Sanger</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In recent years, micro-service is getting popularity and is a buzz word in IT/Software industry.<br />
Micro-services are an architectural style or an approach to build IT systems as a set of business capabilities that are autonomous, self-contained, and loosely coupled. Its used to achieve agility, the speed of delivery and scaling.</p>
<p>Many organizations such as Netflix and Amazon used this technique to functionally partition their applications into smaller atomic units.</p>
<p>Micro-services originated from the idea of hexagonal architecture. Hexagonal architecture is also known as the Ports and Adapters Pattern.<br />
<a href="http://alistair.cockburn.us/Hexagonal+architecture">Hexagonal Architecture &gt;&gt; </a></p>
<div id="attachment_359" style="width: 962px" class="wp-caption alignnone"><a href="https://www.manishsanger.com/wp-content/uploads/2018/04/Monotlithic-application.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-359" class="size-full wp-image-359" src="https://www.manishsanger.com/wp-content/uploads/2018/04/Monotlithic-application.png" alt="Monolithic Application" width="952" height="794" srcset="https://www.manishsanger.com/wp-content/uploads/2018/04/Monotlithic-application.png 952w, https://www.manishsanger.com/wp-content/uploads/2018/04/Monotlithic-application-300x250.png 300w, https://www.manishsanger.com/wp-content/uploads/2018/04/Monotlithic-application-768x641.png 768w" sizes="auto, (max-width: 952px) 100vw, 952px" /></a><p id="caption-attachment-359" class="wp-caption-text">Monolithic Application</p></div>
<p>Let&#8217;s take an example of an E-commerce application. In a typical monolithic architecture, all modules are part of the same project/package and are connected with single database technology as shown in the architecture above. Here are some of the problem, which developer and business were facing with Monolithic architecture over the period of time:</p>
<ol>
<li>In older and large applications, codebase increased over the period of time and it takes ages to build and deploy.</li>
<li>There is a technology constraint with the application, new features have to be developed with old technology stack, or it requires a huge amount of effort to upgrade the version or using latest tools and technologies available.</li>
<li>Each module is tightly coupled with other modules, so if you change one module it will impact the other module also, so maintaining the monolithic applications are more error-prone.</li>
<li>When you make a change in any module, whole application has to be built and deployed again.</li>
<li>You can&#8217;t scale only one section of the application. For example, in an E-commerce application, search and browse catalog usually have the highest load, in the monolithic approach we can&#8217;t only scale these two services only, we have to scale the whole application on separate server instances behind a load balancer.</li>
</ol>
<p>In traditional monolithic application, we build a .war or .ear and deploy it on an application server like Tomcat, JBoss, WebLogic, WebSphere etc. In micro-service architecture, each micro-service will be built as a jar, embedded with all the dependencies and run as a standalone Java process.<br />
Micro-services may also have their own containers for execution. Container technology like Docker is an ideal choice for micro-services deployment.</p>
<div id="attachment_360" style="width: 1042px" class="wp-caption alignnone"><a href="https://www.manishsanger.com/wp-content/uploads/2018/04/Microservices-Architecture.png"><img loading="lazy" decoding="async" aria-describedby="caption-attachment-360" class="size-full wp-image-360" src="https://www.manishsanger.com/wp-content/uploads/2018/04/Microservices-Architecture.png" alt="Microservices Architecture" width="1032" height="860" srcset="https://www.manishsanger.com/wp-content/uploads/2018/04/Microservices-Architecture.png 1032w, https://www.manishsanger.com/wp-content/uploads/2018/04/Microservices-Architecture-300x250.png 300w, https://www.manishsanger.com/wp-content/uploads/2018/04/Microservices-Architecture-768x640.png 768w, https://www.manishsanger.com/wp-content/uploads/2018/04/Microservices-Architecture-1024x853.png 1024w" sizes="auto, (max-width: 1032px) 100vw, 1032px" /></a><p id="caption-attachment-360" class="wp-caption-text">Microservices Architecture</p></div>
<p><strong>Benefits of using micro-services:</strong></p>
<ol>
<li>Can use different architecture, technology and version of the technology for each micro-service.</li>
<li>Enabling experimentation and innovation. for example, recommendation engine, where we keep changing the recommendation algorithm.</li>
<li>Elastically and selectively scalable, we can select only the selected service where application receives the highest load. For example: Search and Catalog section of the e-commerce application.</li>
<li>This enables building up an organic system, where we keep adding the feature in an agile way over the period of time without impacting the existing system.</li>
<li>This helps in reduction of technology debt, we can change/upgrade technologies with much lesser effort/impact as compare to monolithic.</li>
<li>It supporting event-driven architecture, for example: In e-commerce when an order is received various service has to be invoked like: save order, update inventory, send email/SMS/push notification, data analysis, delivery etc.</li>
<li>Micro-service are the key enabler for DevOps. It advocates automating as much as possible, for example, continuous integration &#8211; testing, automatic infrastructure provisioning, automatic build, automatic deployment etc.</li>
</ol>
<p>The post <a href="https://www.manishsanger.com/microservices-an-introduction/">Microservices &#8211; An Introduction</a> appeared first on <a href="https://www.manishsanger.com">Manish Sanger</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.manishsanger.com/microservices-an-introduction/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<enclosure url="https://www.manishsanger.com/wp-content/uploads/2018/04/Microservices-Architecture.png" length="80553" type="image/png"/><media:content url="https://www.manishsanger.com/wp-content/uploads/2018/04/Microservices-Architecture.png" width="1032" height="860" medium="image" type="image/png"/>	</item>
	</channel>
</rss>
