Spring Cloud Tutorials – Auto Refresh Config Changes using Spring Cloud Bus

Problem In the previous article Introduction to Spring Cloud Config Server (http://sivalabs.in/2017/08/spring-cloud-tutorials-introduction-to-spring-cloud-config-server/) we have seen how to use Spring Cloud Config Server. But, the problem is to reload the config changes in Config Client applications we need to trigger /refresh endpoint manually. This is not practical and viable if you have large number of applications. Solution Spring Cloud Bus module can be used to link multiple applications with a message broker and we can broadcast configuration changes. Let us see how we can use RabbitMQ as message broker and connect multiple applications to receive the configuration change events and refresh

Continue reading »

Spring Cloud Tutorials – Introduction to Spring Cloud Config Server

Problem SpringBoot provides lot of flexibility in externalizing configuration properties via properties or YAML files. We can also configure properties for each environment (dev, qa, prod etc) separately using profile specific configuration files such as application.properties, application-dev.properties, application-prod.properties etc. But once the application is started we can not update the properties at runtime. If we change the properties we need to restart the application to use the updated configuration properties. Also, in the context of large number of MicroService based applications, we want the ability to configure and manage the configuration properties of all MicroServices from a centralized place. Solution

Continue reading »

My Review of Sanjay Patel’s Spring Course

Spring is the most popular Java framework for building web and enterprise applications. There are plenty of official documentation, books, and Training Courses available for Spring framework on web. I got an opportunity to review Sanjay Patel‘s Spring Course Material which is divided into 3 modules. http://www.naturalprogrammer.com/spring-tutorial/ The total course is divided into 3 modules covering various aspects of web application development using Spring/SpringBoot framework. Module I : Spring Framework 4 And Dependency Injection For Beginners Module II : Spring Framework for the Real World Module III : Spring Framework REST API Development Module I: Spring Framework 4 and Dependency

Continue reading »

Retrying Method Execution using Spring AOP

One of my blog follower sends an email asking me to show an example of “RealWorld Usage of Spring AOP”. He mentioned that in most of the examples the usage of Spring AOP is demonstrated for logging method entry/exit or Transaction management or Security checks. He wanted to know how Spring AOP is being used in “Real Project for Real Problems”. So I would like to show how I have used Spring AOP for one of my project to handle a real problem. We won’t face some kind of problems in development phases and only come to know during Load Testing or

Continue reading »

Selecting The Technology Stack for JCart

Selecting the right technology stack is very crucial and plays an important role in project success. Many of the architects (unknowingly??!!) try to make complex designs by trying to use all kinds of latest and greatest stuff. On the other hand some architects try to be in their comfort zone by limiting their technology stack to the technologies with which they are comfortable. Both approaches are dangerous. One should understand the business needs and pick the technologies that are necessary for project. Java Platform: We will be using Java 8 for JCart so that we can leverage the good features

Continue reading »

Developing a simple e-commerce application from scratch to production using SpringBoot

We can find plenty of information on any technical topic, be it Java, .NET, Python or any frameworks like Spring, Hibernate, CDI, JSF etc. You can find hundreds of well written blogs on many of these topics. For example, you can find lot of tutorials on how to use SpringBoot or how to use various mappings in JPA/Hibernate or how to do form validations in JSF etc. Also, there are plenty of books published by well established publishers on most of the technologies. But once the “Junior Developer” stage is crossed, many developers would like to learn more about how

Continue reading »

A Developers Perspective on Spring vs JavaEE

In Java community Spring vs JavaEE is a never ending debate. In such debates people form two groups consisting of evangelists, architects and hard core fans of one platform and debate endlessly. Those who participate in the debates may be architects who are responsible for platform selection. But what would developers think about this Spring vs JavaEE debate? I am a Java developer who uses both Spring and JavaEE and I am not part of Spring or JavaEE fan club. Here I would like to share my own thoughts on this epic Spring vs JavaEE debate. 1. Business(sometimes political) AspectsIn

Continue reading »

SpringBoot: Introducing SpringBoot

SpringBoot…there is a lot of buzz about SpringBoot nowadays. So what is SpringBoot? SpringBoot is a new spring portfolio project which takes opinionated view of building production-ready Spring applications by drastically reducing the amount of configuration required. Spring Boot is taking the convention over configuration style to the next level by registering the default configurations automatically based on the classpath libraries available at runtime. Well.. you might have already read this kind of introduction to SpringBoot on many blogs. So let me elaborate on what SpringBoot is and how it helps developing Spring applications more quickly. Spring framework was created

Continue reading »

Book Review: Enterprise Application Development with Ext JS and Spring

I was asked to review “Enterprise Application Development with Ext JS and Spring” book by Packtpub guys and here is my review on the book. Actually now I am working on a project which is being developed using ExtJS and I thought of buying this book. But surprisingly on the very next day I was asked to review this book and gave me the ebook :-). Book WebSite URL: http://www.packtpub.com/enterprise-application-development-with-extjs-and-spring/book Personally I like the books which explains any technology/framework/library by taking a sample application and building the application progressively chapter by chapter. Enterprise Application Development with Ext JS and Spring book

Continue reading »

Deploying BroadleafCommerce 2.0 on JBoss AS 7

First 2 steps are not really related to Broadleaf specific, but mentioned to make it easy to follow(copy/paste) the steps. Step#1: Configure DataSources in JBoss AS. <datasource jta=”true” jndi-name=”java:jboss/datasources/BroadleafDS” pool-name=”BroadleafDS_Pool” enabled=”true” use-java-context=”true” use-ccm=”true”> <connection-url>jdbc:mysql://localhost:3306/broadleaf</connection-url> <driver>mysql</driver> <security> <user-name>root</user-name> <password>admin</password> </security> <timeout> <idle-timeout-minutes>0</idle-timeout-minutes> <query-timeout>600</query-timeout> </timeout> </datasource> <datasource jta=”true” jndi-name=”java:jboss/datasources/BroadleafSecureDS” pool-name=”BroadleafSecureDS_Pool” enabled=”true” use-java-context=”true” use-ccm=”true”> <connection-url>jdbc:mysql://localhost:3306/broadleaf</connection-url> <driver>mysql</driver> <security> <user-name>root</user-name> <password>admin</password> </security> <timeout> <idle-timeout-minutes>0</idle-timeout-minutes> <query-timeout>600</query-timeout> </timeout> </datasource> <datasource jta=”true” jndi-name=”java:jboss/datasources/BroadleafCmsDS” pool-name=”BroadleafCmsDS_Pool” enabled=”true” use-java-context=”true” use-ccm=”true”> <connection-url>jdbc:mysql://localhost:3306/broadleaf</connection-url> <driver>mysql</driver> <security> <user-name>root</user-name> <password>admin</password> </security> <timeout> <idle-timeout-minutes>0</idle-timeout-minutes> <query-timeout>600</query-timeout> </timeout> </datasource> Step#2: Update core/src/main/resources/META-INF/persistence.xml as follows to use DataSources configured in JBossAS7. <?xml version=”1.0″ encoding=”UTF-8″?> <persistence xmlns=”http://java.sun.com/xml/ns/persistence” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd” version=”2.0″>

Continue reading »