SlideShare a Scribd company logo
1 of 26
ACCENTURE
TECHNOLOGY
MEETUP
SPRING BOOT
BASED
MICROSERVICES
• Application as a suit of small services
• Services are split around business capability
• Lightweight
• smaller the better
• Services are independent
• Better testability
• Better deployability
• Improved fault isolation and tolerance
• Great agility and scalability
MICROSERVICES
Copyright © 2018 Accenture. All rights reserved. 2
• CRUD operations
• get, post, put, delete
• Should get all data needed
• Header
• URL (path, request parameters)
• Body (content type?)
MICROSERVICE BASICS
Copyright © 2018 Accenture. All rights reserved. 3
• Naming is consequent with function
• GET /meetup/team
• POST /meetup/team
– -> Location: /meetup/team/{id}
• GET /meetup/team/{id}
• PUT /meetup/team/{id}
• DELETE /meetup/team/{id}
SERVICE URLS
Copyright © 2018 Accenture. All rights reserved. 4
• Headers
• Accept
• Content-Type
• Authentication
• Accept-Language
• Location
• Allow-Origin
HEADERS
Copyright © 2018 Accenture. All rights reserved. 5
• 200 - OK
• 201 - Created
• 204 - No content
• 401 - Unauthorized
• 403 - Forbidden
• 404 - Not found
• 406 - Not acceptable
• 409 - Conflict
• 415 - Unsupported media type
• 422 - Unprocessable entity
RESPONSE CODES
Copyright © 2018 Accenture. All rights reserved. 6
• REST vs SOAP
• Data is provided as input, no state stored
• JSON vs html
• Calling external services
• Dependencies should be avoided
• Shared data between services
• Keep as low as possible
TO DO, OR NOT TO DO?
Copyright © 2018 Accenture. All rights reserved. 7
• data
• mvc
• web
• aop
• annotations
• boot
• cloud
SPRING FUNCTIONS
Copyright © 2018 Accenture. All rights reserved. 8
• Swiss army knife toolkit
• Stand-alone Spring application
• Runnable JAR file
• Tested for stability
• No dependency issues
• Runnable jar
• Embedded application server
• Gradle or Maven support
• Low overhead
SPRING BOOT - BASICS
Copyright © 2018 Accenture. All rights reserved. 9
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
• @SpringBootApplication
• main()
APPLICATION
Copyright © 2018 Accenture. All rights reserved. 10
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
• @RestController
• @RequestMapping
CONTROLLER ANNOTATION
Copyright © 2018 Accenture. All rights reserved. 11
@RestController
public class MeetupController {
@Autowired
private MeetupService meetupService;
@RequestMapping(value = "/person/{id}", method = RequestMethod.GET)
public Optional<Person> getPerson(HttpServletRequest httpServletRequest, @PathVariable("id") String id) {
return meetupService.getPerson(id);
}
• To handle HTTP OPTIONS call
• Implemented as filter
• Headers returned
• Access-Control-Allow-Methods
• Access-Control-Allow-Headers
• Access-Control-Allow-Origin
• Access-Control-Max-Age
• Access-Control-Allow-Credentials
CORS FILTER
Copyright © 2018 Accenture. All rights reserved. 12
• LoggingFilter
• HTTP Request and response
– Headers, URL and params
– doFilter
• ControllerLoggerAspect
• @Component
• @Aspect
• @Before({pointcut})
LOGGING ASPECTS
Copyright © 2018 Accenture. All rights reserved. 13
@Aspect
@Component
public class ControllerLoggerAspect {
@Before("execution(* com.accenture.meetup.controller.MeetupController.*(..))")
public void logBefore(JoinPoint joinPoint) {
}
}
}
@Component
public class LoggingFilter implements Filter {
@Override
public void doFilter(ServletRequest servletRequest,
ServletResponse servletResponse, FilterChain filterChain) {
}
}
• @ControllerAdvice
• implements RequestBodyAdvice
– boolean supports(...)
– beforeBodyRead(...)
– afterBodyRead(...)
– handleEmptyBody(...)
• implements ResponseBodyAdvice
– boolean supports(...)
– beforeBodyWrite(...)
REQUEST AND RESPONSE BODY
Copyright © 2018 Accenture. All rights reserved. 14
@ControllerAdvice
public class RequestBodyLogger implements RequestBodyAdvice {
@Override
public boolean supports(MethodParameter methodParameter,
Type targetType,
Class<? extends HttpMessageConverter<?>> converterType) {
}
@Override
public Object handleEmptyBody(Object body,
HttpInputMessage inputMessage, MethodParameter parameter,
Type targetType,
Class<? extends HttpMessageConverter<?>> converterType) {
}
@Override
public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage,
MethodParameter parameter, Type targetType,
Class<? extends HttpMessageConverter<?>> converterType) {
}
@Override
public Object afterBodyRead(Object body,
HttpInputMessage inputMessage, MethodParameter parameter,
Type targetType,
Class<? extends HttpMessageConverter<?>> converterType) {
}
}
• Implemented as ControllerAdvice
• @ControllerAdvice
• Based on exception type
• @ExceptionHandler
• Sets HTTP error codes
• @ResponseStatus
ERROR HANDLER
Copyright © 2018 Accenture. All rights reserved. 15
@ControllerAdvice
public class GlobalExceptionHandler extends
ResponseEntityExceptionHandler {
@ExceptionHandler(NotFoundException.class)
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public void handleNotFoundException(NotFoundException e) {
logger.error(e.getMessage());
}
}
• spring-data
• One for each entity
• @Repository
• extends CrudRepository(<T, ID>)
– save
– findById
– deleteById
DATABASE ACCESS
Copyright © 2018 Accenture. All rights reserved. 16
@Repository
public interface TeamRepository extends CrudRepository<Team, String> {
}
• Unit tests
• In memory database (h2)
• Mockito and mock mvc for controller - TDD
• Cucumber – BDD
• Sonar – quality gates
• PACT – contract
QUALITY CONTROL
Copyright © 2018 Accenture. All rights reserved. 17
• Uses real service
• Includes filters, aspects and error handlers
• @AutoConfigureMockMvc
• @SpringBootTest
• @RunWith(Springrunner.class)
• mvc.perform()
MOCK MVC
Copyright © 2018 Accenture. All rights reserved. 18
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class MeetupControllerTest {
@Autowired
private MockMvc mvc;
@Test
public void getHealthcheck() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/healthcheck")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
}
}
• Contract based interface verification
• Mock services and interactions
• DSM format
• pact-mock-server
• Can be generated
PACT
Copyright © 2018 Accenture. All rights reserved. 19
Contract
Partner A
e.g. CLIENT
Contract
Partner B
e.g. BACK
END
PACT
• Root interaction
• Options request
• Acceptance vs Compatibility
• Header and body matching
• Samples by value generators
• Json objects
PACT – BEST PRACTICES
Copyright © 2018 Accenture. All rights reserved. 20
Copyright © 2018 Accenture. All rights reserved. 21
• Describes Behaviour – BDD
• Human readable
• POs and BAs can also understand
– Given...
– When...
– Then...
• Scenarios and Scenariooutlines with examples
CUCUMBER
• Physical hardware
• chroot jail, selinux
• VMware, Hyper-V
• shared libs?
• docker (expendables)
• docker builder
• swarm (there's more)
DOCKER EVOLUTION
Copyright © 2018 Accenture. All rights reserved. 22
• perfect match
• easy to...
• integrate (jenkins, maven)
• deploy
• scale
• Can be automatically built
• maven, gradle etc.
• Can be automatically deployed
• CI, CD, jenkins, bamboo etc.
SPRINGBOOT AND DOCKER
Copyright © 2018 Accenture. All rights reserved. 23
• Health check
• spring-actuator
• Logging
• Monitoring
• Sizing (jvm, cpu)
CONSIDERATIONS
Copyright © 2018 Accenture. All rights reserved. 24
• microservice basics
• springboot
• cucumber
• pact
• docker
SUMMARY
Copyright © 2018 Accenture. All rights reserved. 25
THANK YOU
Copyright © 2018 Accenture. All rights reserved. 26
accenture.hu

More Related Content

What's hot

PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootJosué Neis
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample applicationAnil Allewar
 
Full-Stack Development with Spring Boot and VueJS
Full-Stack Development with Spring Boot and VueJSFull-Stack Development with Spring Boot and VueJS
Full-Stack Development with Spring Boot and VueJSVMware Tanzu
 
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...VMware Tanzu
 
Cloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudCloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudConor Svensson
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudEberhard Wolff
 
Microservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloudMicroservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloudBen Wilcock
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Gunith Devasurendra
 
White paper mbre_en
White paper mbre_enWhite paper mbre_en
White paper mbre_enVisioneerUG
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservicesseges
 
Spring Cloud: Why? How? What?
Spring Cloud: Why? How? What?Spring Cloud: Why? How? What?
Spring Cloud: Why? How? What?Orkhan Gasimov
 
Resilient Microservices with Spring Cloud
Resilient Microservices with Spring CloudResilient Microservices with Spring Cloud
Resilient Microservices with Spring CloudVMware Tanzu
 
Testing Microservices
Testing MicroservicesTesting Microservices
Testing MicroservicesAnil Allewar
 
A Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in JavaA Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in JavaVMware Tanzu
 
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfileWhat We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfileEd Burns
 
Spring cloud for microservices architecture
Spring cloud for microservices architectureSpring cloud for microservices architecture
Spring cloud for microservices architectureIgor Khotin
 
What’s New in Spring Data MongoDB
What’s New in Spring Data MongoDBWhat’s New in Spring Data MongoDB
What’s New in Spring Data MongoDBVMware Tanzu
 
What’s New in Spring Batch?
What’s New in Spring Batch?What’s New in Spring Batch?
What’s New in Spring Batch?VMware Tanzu
 

What's hot (20)

PUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBootPUC SE Day 2019 - SpringBoot
PUC SE Day 2019 - SpringBoot
 
Building microservices sample application
Building microservices sample applicationBuilding microservices sample application
Building microservices sample application
 
Full-Stack Development with Spring Boot and VueJS
Full-Stack Development with Spring Boot and VueJSFull-Stack Development with Spring Boot and VueJS
Full-Stack Development with Spring Boot and VueJS
 
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
Fundamental Spring Boot: Keep it Simple, Get it Right, Be Productive and Have...
 
Cloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring CloudCloud Native Microservices with Spring Cloud
Cloud Native Microservices with Spring Cloud
 
Microservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring CloudMicroservices with Java, Spring Boot and Spring Cloud
Microservices with Java, Spring Boot and Spring Cloud
 
Microservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloudMicroservices - java ee vs spring boot and spring cloud
Microservices - java ee vs spring boot and spring cloud
 
Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)Rediscovering Spring with Spring Boot(1)
Rediscovering Spring with Spring Boot(1)
 
White paper mbre_en
White paper mbre_enWhite paper mbre_en
White paper mbre_en
 
Spring Boot and Microservices
Spring Boot and MicroservicesSpring Boot and Microservices
Spring Boot and Microservices
 
Spring Cloud: Why? How? What?
Spring Cloud: Why? How? What?Spring Cloud: Why? How? What?
Spring Cloud: Why? How? What?
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Resilient Microservices with Spring Cloud
Resilient Microservices with Spring CloudResilient Microservices with Spring Cloud
Resilient Microservices with Spring Cloud
 
Testing Microservices
Testing MicroservicesTesting Microservices
Testing Microservices
 
A Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in JavaA Series of Fortunate Events: Building an Operator in Java
A Series of Fortunate Events: Building an Operator in Java
 
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfileWhat We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
What We Learned from Porting PiggyMetrics from Spring Boot to MicroProfile
 
Spring cloud for microservices architecture
Spring cloud for microservices architectureSpring cloud for microservices architecture
Spring cloud for microservices architecture
 
What’s New in Spring Data MongoDB
What’s New in Spring Data MongoDBWhat’s New in Spring Data MongoDB
What’s New in Spring Data MongoDB
 
What’s New in Spring Batch?
What’s New in Spring Batch?What’s New in Spring Batch?
What’s New in Spring Batch?
 

Similar to Spring Boot Microservices Meetup

Getting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the CloudGetting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the CloudRevelation Technologies
 
Webinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamicsWebinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamicsTodd Radel
 
Microservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache CassandraMicroservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache CassandraJorge Bay Gondra
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023VMware Tanzu
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023VMware Tanzu
 
Structured Functional Automated Web Service Testing
Structured Functional Automated Web Service TestingStructured Functional Automated Web Service Testing
Structured Functional Automated Web Service Testingrdekleijn
 
Hands-On Lab: Improve large network visibility and operational efficiency wit...
Hands-On Lab: Improve large network visibility and operational efficiency wit...Hands-On Lab: Improve large network visibility and operational efficiency wit...
Hands-On Lab: Improve large network visibility and operational efficiency wit...CA Technologies
 
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdfNET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdfTamir Dresher
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB
 
Building 12-factor Cloud Native Microservices
Building 12-factor Cloud Native MicroservicesBuilding 12-factor Cloud Native Microservices
Building 12-factor Cloud Native MicroservicesJakarta_EE
 
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...AWS Chicago
 
Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...
Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...
Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...Amazon Web Services
 
Spring boot microservice metrics monitoring
Spring boot   microservice metrics monitoringSpring boot   microservice metrics monitoring
Spring boot microservice metrics monitoringOracle Korea
 
Spring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics MonitoringSpring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics MonitoringDonghuKIM2
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB
 
Microservices and APIs
Microservices and APIsMicroservices and APIs
Microservices and APIsPuneet Sachdev
 
Performance testing - Accenture
Performance testing - AccenturePerformance testing - Accenture
Performance testing - AccentureGeetikaVerma16
 

Similar to Spring Boot Microservices Meetup (20)

Getting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the CloudGetting Started with API Management – Why It's Needed On-prem and in the Cloud
Getting Started with API Management – Why It's Needed On-prem and in the Cloud
 
Webinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamicsWebinar - Building Custom Extensions With AppDynamics
Webinar - Building Custom Extensions With AppDynamics
 
Microservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache CassandraMicroservices with Node.js and Apache Cassandra
Microservices with Node.js and Apache Cassandra
 
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
Simplify and Scale Enterprise Apps in the Cloud | Boston 2023
 
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
Simplify and Scale Enterprise Apps in the Cloud | Seattle 2023
 
Structured Functional Automated Web Service Testing
Structured Functional Automated Web Service TestingStructured Functional Automated Web Service Testing
Structured Functional Automated Web Service Testing
 
Hands-On Lab: Improve large network visibility and operational efficiency wit...
Hands-On Lab: Improve large network visibility and operational efficiency wit...Hands-On Lab: Improve large network visibility and operational efficiency wit...
Hands-On Lab: Improve large network visibility and operational efficiency wit...
 
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdfNET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
NET Aspire - NET Conf IL 2024 - Tamir Dresher.pdf
 
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch TutorialMongoDB.local Seattle 2019: MongoDB Stitch Tutorial
MongoDB.local Seattle 2019: MongoDB Stitch Tutorial
 
Building 12-factor Cloud Native Microservices
Building 12-factor Cloud Native MicroservicesBuilding 12-factor Cloud Native Microservices
Building 12-factor Cloud Native Microservices
 
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
Journey to containers by Chet Lintz - AWS Chicago Jan 17,2018 user group on C...
 
Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...
Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...
Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...
 
Clean Architecture @ Taxibeat
Clean Architecture @ TaxibeatClean Architecture @ Taxibeat
Clean Architecture @ Taxibeat
 
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONSSERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS
 
Click2Cloud UAT Tool
Click2Cloud UAT ToolClick2Cloud UAT Tool
Click2Cloud UAT Tool
 
Spring boot microservice metrics monitoring
Spring boot   microservice metrics monitoringSpring boot   microservice metrics monitoring
Spring boot microservice metrics monitoring
 
Spring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics MonitoringSpring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics Monitoring
 
MongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch TutorialMongoDB.local Atlanta: MongoDB Stitch Tutorial
MongoDB.local Atlanta: MongoDB Stitch Tutorial
 
Microservices and APIs
Microservices and APIsMicroservices and APIs
Microservices and APIs
 
Performance testing - Accenture
Performance testing - AccenturePerformance testing - Accenture
Performance testing - Accenture
 

More from Accenture Hungary

Salesforce meetup | Custom document generation
Salesforce meetup | Custom document generationSalesforce meetup | Custom document generation
Salesforce meetup | Custom document generationAccenture Hungary
 
Salesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentSalesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentAccenture Hungary
 
Industry X.0 | Smart Factory | Session no.3
Industry X.0 | Smart Factory | Session no.3Industry X.0 | Smart Factory | Session no.3
Industry X.0 | Smart Factory | Session no.3Accenture Hungary
 
Accenture Salesforce Developer Meetup vol 1 2019
Accenture Salesforce Developer Meetup vol 1 2019Accenture Salesforce Developer Meetup vol 1 2019
Accenture Salesforce Developer Meetup vol 1 2019Accenture Hungary
 
Industry X.0 | Smart Factory | Session no.2
Industry X.0 | Smart Factory | Session no.2Industry X.0 | Smart Factory | Session no.2
Industry X.0 | Smart Factory | Session no.2Accenture Hungary
 
SAP S4/HANA meetup overview
SAP S4/HANA meetup overview SAP S4/HANA meetup overview
SAP S4/HANA meetup overview Accenture Hungary
 
Industry X.0 | Smart Factory | Session no.1
Industry X.0 | Smart Factory | Session no.1Industry X.0 | Smart Factory | Session no.1
Industry X.0 | Smart Factory | Session no.1Accenture Hungary
 
Introduction to NEW SAP - Accenture Technology Meetup
Introduction to NEW SAP - Accenture Technology MeetupIntroduction to NEW SAP - Accenture Technology Meetup
Introduction to NEW SAP - Accenture Technology MeetupAccenture Hungary
 
SCADA a gyakorlatban - Accenture Industry X.0 Meetup
SCADA a gyakorlatban - Accenture Industry X.0 MeetupSCADA a gyakorlatban - Accenture Industry X.0 Meetup
SCADA a gyakorlatban - Accenture Industry X.0 MeetupAccenture Hungary
 
Digital Thread & Digital Twin
Digital Thread & Digital TwinDigital Thread & Digital Twin
Digital Thread & Digital TwinAccenture Hungary
 

More from Accenture Hungary (13)

Virtual validation tool
Virtual validation toolVirtual validation tool
Virtual validation tool
 
Salesforce meetup | Custom document generation
Salesforce meetup | Custom document generationSalesforce meetup | Custom document generation
Salesforce meetup | Custom document generation
 
Salesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web ComponentSalesforce meetup | Lightning Web Component
Salesforce meetup | Lightning Web Component
 
Industry X.0 | Smart Factory | Session no.3
Industry X.0 | Smart Factory | Session no.3Industry X.0 | Smart Factory | Session no.3
Industry X.0 | Smart Factory | Session no.3
 
Accenture Salesforce Developer Meetup vol 1 2019
Accenture Salesforce Developer Meetup vol 1 2019Accenture Salesforce Developer Meetup vol 1 2019
Accenture Salesforce Developer Meetup vol 1 2019
 
PLC Student Meetup
PLC Student MeetupPLC Student Meetup
PLC Student Meetup
 
Industry X.0 | Smart Factory | Session no.2
Industry X.0 | Smart Factory | Session no.2Industry X.0 | Smart Factory | Session no.2
Industry X.0 | Smart Factory | Session no.2
 
SAP S4/HANA meetup overview
SAP S4/HANA meetup overview SAP S4/HANA meetup overview
SAP S4/HANA meetup overview
 
Industry X.0 | Smart Factory | Session no.1
Industry X.0 | Smart Factory | Session no.1Industry X.0 | Smart Factory | Session no.1
Industry X.0 | Smart Factory | Session no.1
 
Accenture Java meetup
Accenture Java meetupAccenture Java meetup
Accenture Java meetup
 
Introduction to NEW SAP - Accenture Technology Meetup
Introduction to NEW SAP - Accenture Technology MeetupIntroduction to NEW SAP - Accenture Technology Meetup
Introduction to NEW SAP - Accenture Technology Meetup
 
SCADA a gyakorlatban - Accenture Industry X.0 Meetup
SCADA a gyakorlatban - Accenture Industry X.0 MeetupSCADA a gyakorlatban - Accenture Industry X.0 Meetup
SCADA a gyakorlatban - Accenture Industry X.0 Meetup
 
Digital Thread & Digital Twin
Digital Thread & Digital TwinDigital Thread & Digital Twin
Digital Thread & Digital Twin
 

Recently uploaded

Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 

Recently uploaded (20)

Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 

Spring Boot Microservices Meetup

  • 2. • Application as a suit of small services • Services are split around business capability • Lightweight • smaller the better • Services are independent • Better testability • Better deployability • Improved fault isolation and tolerance • Great agility and scalability MICROSERVICES Copyright © 2018 Accenture. All rights reserved. 2
  • 3. • CRUD operations • get, post, put, delete • Should get all data needed • Header • URL (path, request parameters) • Body (content type?) MICROSERVICE BASICS Copyright © 2018 Accenture. All rights reserved. 3
  • 4. • Naming is consequent with function • GET /meetup/team • POST /meetup/team – -> Location: /meetup/team/{id} • GET /meetup/team/{id} • PUT /meetup/team/{id} • DELETE /meetup/team/{id} SERVICE URLS Copyright © 2018 Accenture. All rights reserved. 4
  • 5. • Headers • Accept • Content-Type • Authentication • Accept-Language • Location • Allow-Origin HEADERS Copyright © 2018 Accenture. All rights reserved. 5
  • 6. • 200 - OK • 201 - Created • 204 - No content • 401 - Unauthorized • 403 - Forbidden • 404 - Not found • 406 - Not acceptable • 409 - Conflict • 415 - Unsupported media type • 422 - Unprocessable entity RESPONSE CODES Copyright © 2018 Accenture. All rights reserved. 6
  • 7. • REST vs SOAP • Data is provided as input, no state stored • JSON vs html • Calling external services • Dependencies should be avoided • Shared data between services • Keep as low as possible TO DO, OR NOT TO DO? Copyright © 2018 Accenture. All rights reserved. 7
  • 8. • data • mvc • web • aop • annotations • boot • cloud SPRING FUNCTIONS Copyright © 2018 Accenture. All rights reserved. 8
  • 9. • Swiss army knife toolkit • Stand-alone Spring application • Runnable JAR file • Tested for stability • No dependency issues • Runnable jar • Embedded application server • Gradle or Maven support • Low overhead SPRING BOOT - BASICS Copyright © 2018 Accenture. All rights reserved. 9 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.1.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies>
  • 10. • @SpringBootApplication • main() APPLICATION Copyright © 2018 Accenture. All rights reserved. 10 @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
  • 11. • @RestController • @RequestMapping CONTROLLER ANNOTATION Copyright © 2018 Accenture. All rights reserved. 11 @RestController public class MeetupController { @Autowired private MeetupService meetupService; @RequestMapping(value = "/person/{id}", method = RequestMethod.GET) public Optional<Person> getPerson(HttpServletRequest httpServletRequest, @PathVariable("id") String id) { return meetupService.getPerson(id); }
  • 12. • To handle HTTP OPTIONS call • Implemented as filter • Headers returned • Access-Control-Allow-Methods • Access-Control-Allow-Headers • Access-Control-Allow-Origin • Access-Control-Max-Age • Access-Control-Allow-Credentials CORS FILTER Copyright © 2018 Accenture. All rights reserved. 12
  • 13. • LoggingFilter • HTTP Request and response – Headers, URL and params – doFilter • ControllerLoggerAspect • @Component • @Aspect • @Before({pointcut}) LOGGING ASPECTS Copyright © 2018 Accenture. All rights reserved. 13 @Aspect @Component public class ControllerLoggerAspect { @Before("execution(* com.accenture.meetup.controller.MeetupController.*(..))") public void logBefore(JoinPoint joinPoint) { } } } @Component public class LoggingFilter implements Filter { @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) { } }
  • 14. • @ControllerAdvice • implements RequestBodyAdvice – boolean supports(...) – beforeBodyRead(...) – afterBodyRead(...) – handleEmptyBody(...) • implements ResponseBodyAdvice – boolean supports(...) – beforeBodyWrite(...) REQUEST AND RESPONSE BODY Copyright © 2018 Accenture. All rights reserved. 14 @ControllerAdvice public class RequestBodyLogger implements RequestBodyAdvice { @Override public boolean supports(MethodParameter methodParameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { } @Override public Object handleEmptyBody(Object body, HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { } @Override public HttpInputMessage beforeBodyRead(HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { } @Override public Object afterBodyRead(Object body, HttpInputMessage inputMessage, MethodParameter parameter, Type targetType, Class<? extends HttpMessageConverter<?>> converterType) { } }
  • 15. • Implemented as ControllerAdvice • @ControllerAdvice • Based on exception type • @ExceptionHandler • Sets HTTP error codes • @ResponseStatus ERROR HANDLER Copyright © 2018 Accenture. All rights reserved. 15 @ControllerAdvice public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { @ExceptionHandler(NotFoundException.class) @ResponseStatus(value = HttpStatus.NOT_FOUND) public void handleNotFoundException(NotFoundException e) { logger.error(e.getMessage()); } }
  • 16. • spring-data • One for each entity • @Repository • extends CrudRepository(<T, ID>) – save – findById – deleteById DATABASE ACCESS Copyright © 2018 Accenture. All rights reserved. 16 @Repository public interface TeamRepository extends CrudRepository<Team, String> { }
  • 17. • Unit tests • In memory database (h2) • Mockito and mock mvc for controller - TDD • Cucumber – BDD • Sonar – quality gates • PACT – contract QUALITY CONTROL Copyright © 2018 Accenture. All rights reserved. 17
  • 18. • Uses real service • Includes filters, aspects and error handlers • @AutoConfigureMockMvc • @SpringBootTest • @RunWith(Springrunner.class) • mvc.perform() MOCK MVC Copyright © 2018 Accenture. All rights reserved. 18 @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc public class MeetupControllerTest { @Autowired private MockMvc mvc; @Test public void getHealthcheck() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/healthcheck") .accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()); } }
  • 19. • Contract based interface verification • Mock services and interactions • DSM format • pact-mock-server • Can be generated PACT Copyright © 2018 Accenture. All rights reserved. 19 Contract Partner A e.g. CLIENT Contract Partner B e.g. BACK END PACT
  • 20. • Root interaction • Options request • Acceptance vs Compatibility • Header and body matching • Samples by value generators • Json objects PACT – BEST PRACTICES Copyright © 2018 Accenture. All rights reserved. 20
  • 21. Copyright © 2018 Accenture. All rights reserved. 21 • Describes Behaviour – BDD • Human readable • POs and BAs can also understand – Given... – When... – Then... • Scenarios and Scenariooutlines with examples CUCUMBER
  • 22. • Physical hardware • chroot jail, selinux • VMware, Hyper-V • shared libs? • docker (expendables) • docker builder • swarm (there's more) DOCKER EVOLUTION Copyright © 2018 Accenture. All rights reserved. 22
  • 23. • perfect match • easy to... • integrate (jenkins, maven) • deploy • scale • Can be automatically built • maven, gradle etc. • Can be automatically deployed • CI, CD, jenkins, bamboo etc. SPRINGBOOT AND DOCKER Copyright © 2018 Accenture. All rights reserved. 23
  • 24. • Health check • spring-actuator • Logging • Monitoring • Sizing (jvm, cpu) CONSIDERATIONS Copyright © 2018 Accenture. All rights reserved. 24
  • 25. • microservice basics • springboot • cucumber • pact • docker SUMMARY Copyright © 2018 Accenture. All rights reserved. 25
  • 26. THANK YOU Copyright © 2018 Accenture. All rights reserved. 26 accenture.hu