Rest/Restful Api Interview Questions and Answers | Part 2| Swagger Spring boot tutorial |Code Decode
Code Decode
View ChannelAbout
Subscriber and Follow Code Decode Subscribe Code Decode : https://www.youtube.com/c/CodeDecode?sub_confirmation=1 Linkedin : https://www.linkedin.com/in/codedecodeyoutube/ Instagram : https://www.instagram.com/codedecode25/
Latest Posts
Video Description
In this video code decode have explained rest api interview questions for experienced candidate along with swagger implementation. Udemy Course of Code Decode on Microservice k8s AWS CICD link: https://openinapp.co/udemycourse Course Description Video : https://yt.openinapp.co/dmjvd Rest Api part 2 : https://youtu.be/JjkIUN_vUvI How Do you share REST API contracts you created with Front end team? There are multiple ways to share the created Rest API contract with front end or any other backend team who wants to access your service. You can share the CURL from postman. Best practice is to Implement the Swagger and configure it in such a way that as soon as you start your server the APIs must be automatically documented in Swagger UI. What is SWAGGER Documentation From Your API Design As your project grows with the time, The number of rest end points to fulfilment new functionalities also increases. And so does the headache of maintaining API docs Swagger tools takes the hard work out of generating and maintaining your API docs, ensuring your documentation stays up-to-date as your API evolves. For existing APIs: Documentation can be auto-generated from an API definition. For new APIs - on startup that too will be auto generated. You can maintain multiple versions too. What is SWAGGER UI Swagger UI allows Developers Front end team members Other Service users who calls your Rest endpoints for some data / functionality to visualize and interact with the API’s resources without having any of the implementation logic in place Understanding Code @EnableSwagger2 - Enables Springfox swagger 2 return new Docket(DocumentationType.SWAGGER_2) - Springfox’s, primary api configuration mechanism is initialized for swagger specification 2.0 groupName("public-api") - Docket helps configure a subset of the services to be documented and groups them by name. Like - public-api , private-apis, business-api, admin-specific-apis apiInfo(apiInfo()) - return ApiInfoBuilder - Builds the api information - like title, description, version, license etc. select() - select() returns an instance of ApiSelectorBuilder to give fine grained control over the endpoints exposed via swagger. apis() allows selection of RequestHandler's using a predicate. The example here uses an any predicate (default). Out of the box predicates provided are any, none, withClassAnnotation, withMethodAnnotation and basePackage. Steps used - Summarize add dependency in POM file in Rest API demo project Add swagger config file in Rest API demo project 3) Hit : http://localhost:8080/swagger-ui.html#/ 4) now u see Basic error controller : configure Swagger in a Spring Boot application to hide paths exposed by the BasicErrorController. solutions' 1) 4.1. Exclude with basePackage() //.apis(RequestHandlerSelectors.basePackage("com.codedecode.demo.controller")) 2) I think, the most elegant solution is to include only @RestController controllers into swagger, only thing to bear in mind, is to annotate all the REST controllers with that annotation: .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)) As BasicErrorController is annotated with @Controller only, swagger would avoid BasicErrorController in definition file in Rest APi demo project Most Asked Core Java Interview Questions and Answers : https://youtube.com/playlist?list=PLyHJZXNdCXscoyL5XEZoHHZ86_6h3GWE1 Advance Java Interview Questions and Answers : https://youtube.com/playlist?list=PLyHJZXNdCXsexOO1VQ4vs-BM2-8CKrixd Java 8 Interview Questions and Answers : https://youtube.com/playlist?list=PLyHJZXNdCXsdeusn4OM33415DCMQ6sUKy Hibernate Interview Questions and Answers : https://youtube.com/playlist?list=PLyHJZXNdCXsdC-p2186C6NO4FpadnCC_q Spring Boot Interview Questions and Answers : https://youtube.com/playlist?list=PLyHJZXNdCXsexOO1VQ4vs-BM2-8CKrixd Angular Playlist : https://www.youtube.com/watch?v=CAl7RQSdq2Q&list=PLyHJZXNdCXsfxRtDwtGkDD_lLfTWc1g0i SQL Playlist : https://www.youtube.com/playlist?list=PLyHJZXNdCXse86eLuwy5uZohd_bddE9Ni GIT : https://youtube.com/playlist?list=PLyHJZXNdCXscpl6pxOnL2lRWJlzvzjyZE Subscriber and Follow Code Decode Subscriber Code Decode : https://www.youtube.com/c/CodeDecode?sub_confirmation=1 LinkedIn : https://www.linkedin.com/in/codedecodeyoutube/ Instagram : https://www.instagram.com/codedecode25/ #restapi #codedecode #swaggerrestapi
Transform Your Space Today
AI-recommended products based on this video

Camping String Lights Outdoor, 6 in 1 Outdoor Waterproof Solar/USB Rechargeable Retractable Portable Stowable String Light with 8 Modes (42ft), Tent Lights for Camping, Hiking, Yard, RV (Multicolor)



