DEV Community

Cover image for Springboot-GooglereCAPTCHA
Abdallah Mahmoud
Abdallah Mahmoud

Posted on

Springboot-GooglereCAPTCHA

GooglereCAPTCHA
I hope you doing well. Today I’ll talk about Google reCAPTCHA v2 which provided by Google API. I am using Springboot for my coding backend and Thymeleaf as my View Resolver.

Let me start.

Step#1:

  1. Go to google and google recaptcha admin console
  2. Login with your Gmail account
  3. Create captcha v2 by giving name, type, owner and domain.
  4. Then you will get two keys :
  • Client side key secret
  • Server side key secret

Step#2:

  1. Go to https://start.spring.io/
  2. Open your favorite IDE , I am using Intellij Idea 2021.1.2 [Community Edition]
  3. Choose your project name,groupId and artifact.
  4. Use java 8 and higher as your version
  5. Select following dependencies
  • Spring Web
  • Spring Data Jpa
  • Thymeleaf
  • H2 Database for persistence
  • Lombok for POJO classes.

I create my project structure, I always tell my friend to structure there projects, don’t miss up everything one package.
Project Structure

  1. CUSTOMER as my model class : Customer, CaptchaResponse
  2. Repository :CustomerRepository
  3. Services :ICustomerService, CustomerServiceImpl
  4. Controller :CustomerController
  5. Configuration class for reCAPTCHA :AppConfig

I can’t explain each and every line of code for this simple article but I am sharing my github link where you can clone and analysis in your own way.

GooglereCAPTCHA

GooglereCAPTCHA

Thank you All.

Top comments (0)