Tag Archives: spring framework

Java – Configure MySQL for Google Appengine (Standard)

configure mysql for google appengine standard environment

In this post, you will learn about how to configure MySQL properties in your Spring Boot application for deploying it on Google AppEngine (Standard) environment. This article assumes that the MySQL database is set up as part of Google Cloud SQL fully-managed database service. The following will be covered: Configuration properties in Application.properties Configure POM entries in pom.xml file Configuration properties in Application.properties In application.properties file, while working with Spring Boot app with JPA repository, you need to have following configuration properties in application.properties file. The below assumes that you have a MySQL database with name as dbname and username/password as root/root. In above properties, the instance connection name can be …

Continue reading

Posted in Google Cloud, Java, Web. Tagged with , , , .

Google Recaptcha with Angular and Spring App – Example

Google Recaptcha with Angular and Spring App

In this post, you will learn about how to implement Google Recaptcha with Angular and Spring/Java App. Get Recaptcha code (Key) from Google Angular – Process the Recaptcha code in Login/Sign up Component Spring/Java – RecaptchaVerifier utility class Spring/Java – Verify the Recaptcha Response in Server Side Code Get Recaptcha Code (Secret Keys) from Google Go to Google Recaptcha website and get the code for your website. The Google recaptcha code looks like following: Place the code in appropriate place in login, signup pages. In the login form, it would with code such as following: The Signup form with Google Recaptcha would look like following. The working example can be …

Continue reading

Posted in AngularJS, Java, Tutorials, Web. Tagged with , , , .

Integrate MailGun with Spring Boot and Java App

Mailgun integration with Spring Boot and Java

In this post, you will learn about integrating your Spring Boot & Java app with MailGun REST API. The following are some of the points covered: Create & Configure/Load MailGun API details MailGun EmailService custom implementation Spring RestTemplate implementation Invoke/Test Email Service Create & Configure/Load MailGun API Details The following represents the Config class used to load the configuration beans by loading the properties from application.properties file. The following represents the code in application.properties file: You could get the above details from MailGun Dashboard. MailGun EmailService Custom Implementation Pay attention to some of the following in the code sample given below: Custom RestClient (Spring RestTemplate) is used for making calls …

Continue reading

Posted in Java. Tagged with , , .

Integrate Send Grid with Spring Boot & Java App

SendGrid with Spring Boot and Java

In this post, you will learn about integrating your Spring Boot & Java app with SendGrid Web API. The following are some of the points covered: Create & Configure/Load SendGrid API Key Configure SendGrid Maven entry in POM.xml SendGrid EmailService custom implementation Invoke/Test Email Service Create & Configure/Load SendGrid API Key Create an account with SendGrid.com Go to SendGrid Setup Guide using Web API page. Create an API key. Execute the following script in your development environment. Alternatively, you could also configure the SendGrid API key in your application.properties file and read the key details as part of loading configuration beans. The following is the sample code: In the above code …

Continue reading

Posted in Java. Tagged with , , .

AWS SNS Example with Spring Boot & Java

aws sns example with spring boot and java

Amazon Simple Notification Service (SNS) is a fully managed pub/sub messaging and mobile notifications service for coordinating the delivery of messages to subscribing endpoints and clients. One can get started with Amazon SNS using AWS console or AWS CLI or AWS SDK. One example of how Amazon SNS can be used is the following: Publish a JSON message (consisting of phone no. and message) to Amazon SNS topic Above which will result in triggering an Amazon Lambda function which could in turn trigger Amazon Polly to generate text-to-speech, and, subsequently, invoke Twilio API to make the call to destined phone number. In this post, you will learn about how to …

Continue reading

Posted in AWS, Java. Tagged with , , .

Spring Boot & Angular 5 PWA Dev Environment Setup

Spring Boot Angular App Development Environment

In this post, you will learn about how to quickly create development environment to build an app using Spring Boot and Angular 5. Angular 5 app and Spring Boot is deployed as one single unit on Tomcat server. The following points are covered: Create a Spring Boot Spring Starter Project Create an Angular Service Worker Project Modify POM.xml for Copying Angular App Assets Create a deployment script for automated build and deployments Create a Spring Boot Spring Starter Project Within Eclipse IDE, create a Spring Starter Project for sample Spring Boot app. You may download to SpringSuite Tool Suite (STS) from Eclipse marketplace to have options such as Spring starter …

Continue reading

Posted in AngularJS, Java, Web. Tagged with , , , .

Spring Boot JPA MySQL Sample App – Code Example

spring boot jpa mysql code example

Creating a Spring Boot app with MySQL data source is something every Java developer come across when thinking of creating a quick POC or app. This post is aimed to provide quick code samples which can be used to quickly create a MySQL-based Spring boot app. In this post, you will learn about code examples in relation to getting setup with Spring Boot app which interacts with MySQL database. The following are some of the topics covered: Define properties in application.properties file Create/Configure Database-related Beans Create Entity Classes (Domain) Create Database Implementation Classes (DAOs) Define Service Classes for interacting with Data Access Objects Invoke service class from SpringBoot main program …

Continue reading

Posted in Java, Web. Tagged with , , .

Twilio & AWS S3 using Java & Spring Boot – Code Example

twilio and AWS S3 with Java and Spring Boot

Twilio is a very popular communication service which could be used to send SMS, make the phone or video calls to people in different countries. In this post, you will learn about creating Java and Spring Boot app in relation to how to use Twilio phone service to make a phone call and play audio stored at AWS S3 bucket. The following are some of the related use cases: Play security and other alerts via phone calls Play messages of any kind via phone calls The following are some of the topics which would be covered in this post: Define VoiceService interface defining APIs Create Twilio Voice Service implementation Load …

Continue reading

Posted in AWS, Java. Tagged with , , , .

AWS Temporary Credentials with Java & Spring Boot

AWS Temporary Security Credentials - AWS STS

AWS Security Token Service (STS) is an Amazon web service which enables you to request temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users or for users that you authenticate (federated users). By default, the AWS Security Token Service (AWS STS) is available as a global service, and all AWS STS requests go to a single endpoint at https://sts.amazonaws.com. You can optionally send your AWS STS requests to endpoints in any of the AWS regions shown in the table that follows. In this post, you would learn how to use AWS security token service to create temporary security credentials with Spring Boot and Java app. I would recommend …

Continue reading

Posted in AWS, Java, Tutorials. Tagged with , , .

10 Spring Framework Interview Questions for Freshers

Spring framework interview questions for freshers

Spring Framework is one of the most popular and widely used Java frameworks which makes it very easy to create a Java application/web application using several out-of-box framework components provided by Spring. Thus, it is imperative that beginners starting to do Java web app would end up using Spring framework for building the app. From that perspective, it becomes of great importance for beginners to take note of some of the basic concepts related to which interview questions can be asked. In this post, you will learn some of the Spring framework fundamentals concepts which could be asked in form of interview questions and answers. These questions and answers may …

Continue reading

Posted in Career Planning, Freshers, Interview questions, Java. Tagged with , , .

Amazon S3 with Spring Boot & Java – Sample Code

amazon S3 with Spring Boot and Java

Amazon Simple Storage Service (S3) is an AWS object storage platform which helps you to store the files/data in form of objects, and, store and retrieve any amount of data from anywhere – websites and mobile apps, corporate applications, and data from IoT sensors or devices. Each file stored in Amazon S3 (as an object) is represented using a key. The following are some of the usecases where S3 could be used. Thus, it becomes of utmost importance to understand how to interact with Amazon S3 API using AWS SDKs including AWS Java SDK. Backup & recovery Data archiving Big data analytics Disaster recovery Cloud-native application data Hybrid cloud storage …

Continue reading

Posted in AWS, Java, Tutorials. Tagged with , , .

Amazon Polly Hello World with Java & Spring Boot

amazon polly with spring boot and java

Amazon Polly is one cool AWS service which can be used to achieve requirements such as creating business, security alerts via phone call. When integrated with communication providers such as Twilio, several value-added services could be created using Amazon Polly AWS service. In this post, you will learn about creating a sample Java app which uses Amazon Polly service for converting text to speech. You should be able to listen to the following text using the program given below: Hello World! How are you doing? This is Polly. I am happy to talk with you. The following are some of the aspects covered in this post: Create a Spring Boot app …

Continue reading

Posted in AI, AWS, Cloud, Java, Tutorials. Tagged with , , , .

Spring Boot CommandLineRunner Code Example

spring boot app using command liner

Spring Boot helps you quickly get started with building a Spring-based web app in no time. All you need to do is go to Eclipse IDE, create a new Spring Starter Project and that is it. This is provided you installed Eclipse plugin, Spring Tools (aka Spring IDE and Spring Tool Suite) by going to Help > Eclipse Marketplace… and searching for “spring tools” keyword. Often, one wants to run a Spring Boot app as a Java application as like a traditional Java program and test different parts of their app. In this post, you will get a template code for quickly getting started with Command Liner which would help …

Continue reading

Posted in Java, Tutorials. Tagged with , , .

Spring Boot & Angular App Hello World as One Deployable War

deploying spring and angular app as deployable war

This article represents steps and related code samples to deploy an Angular app (created with Angular 2.*, Angular 4.* or Angular 5.*) with a Spring Boot / Spring Web app as one deployable unit (war file) on the web server such as Tomcat, Jetty etc. Different Deployment Strategies for Spring Boot and Angular App The following are the two different strategies which can be used for deploying web app built with Angular 5.* (and previous versions such as Angular 4.* or Angular 2.*) used for doing client side programming and Spring boot with Spring Web for server-side programming. Deploy Angular App and Spring Boot / Spring Web app as different applications running on different servers; This implies that users connect …

Continue reading

Posted in AngularJS, Java, Javascript, Web. Tagged with , , .

Spring Framework Interview Questions & Answers – Set 1

Spring framework interview questions and answers

This is a practice test / interview questions and answers for Java Developers working on Spring Framework. These questions can be used to check your knowledge on Spring framework fundamentals. They could be useful and helpful in preparing you for upcoming interview in relation with Spring framework. The following are some of the topics in relation with Spring Framework Fundamentals which are covered in this practice test: Spring IOC concepts Configuration metadata Beans packages for IOC container Beans instantiation Different types of DI techniques (Constructor-based, Setter-based DI) Beans initialization (Eager / lazy initialization) Method injection techniques (lookup method, arbitrary method injection) Bean Scopes (Singleton, Prototype, Request, Session, Application, WebSocket) Practice Test on Spring Framework Fundamentals

Posted in Interview questions, Java, Web. Tagged with , , .

How to Configure SpringLoaded with Eclipse Dynamic Web Project

The article presents simple steps to use SpringLoaded framework to have your classes loaded onto the tomcat server without you having required to restart the server, while you are working with Eclipse Dynamic Web Project. The instructions below applies when you have installed Tomcat server and added the same to the eclipse. Quick Introduction on SpringLoaded SpringLoaded, a framework published by Spring.io, is a JVM agent for reloading class file changes whilst a JVM is running. It transforms classes at loadtime to make them amenable to later reloading. Read further on this github page. Personally, I have found it very useful as I do not have to build and restart servers …

Continue reading

Posted in Java. Tagged with , .