SpringBoot – Multiple Choice Questions and Answers – MCQ1

HOME








@Bean 
public MyService myService() {     
  return new MyServiceImpl(); 
}



@RestController
public class ArticleController {
    @GetMapping("/articles")
    public List<Article> getAllArticles() {
        return articleService.findAll();
    }
}

@Value("${my.api.key}")
private String apiKey;

@Bean
@Scope("prototype")
public Article article() {
    return new Article();
}



@Profile("dev")
@Bean
public DataSource dataSource() {
    return new H2DataSource();
}




@Scheduled(fixedRate = 2000)
public void reportCurrentTime() {
    System.out.println("Current time: " + new Date());
}





How to generate an access token and pass to another request in Postman?

HOME

pm.environment.set("TOKEN", pm.response.json().access_token)

Key: Authorization
Value: Bearer {{Token}}

How to set Content-Type in Postman: A Simple Guide

HOME

https://api.restful-api.dev/objects

{
   "name": "Apple MacBook Pro 16",
   "data": {
      "year": 2019,
      "price": 1849.99,
      "CPU model": "Intel Core i9",
      "Hard disk size": "1 TB"
   }
}

Docker Cheat Sheet 2025

HOME

docker --version
docker login
docker logout
docker -d
docker info

docker images
docker build -t [image_name] .
 docker build -t [image_name] . –no-cache 
docker pull [image]
docker tag [image] [new_image]
docker rmi [image_id]
 docker image prune 

docker ps
docker ps -a
docker run [image]
docker ps -a
docker run [image]
docker run --name [container_name] [image_name]
docker run  -d --name [container_name] [image_name]
docker run --name [name] [image]
docker exec -it [container_name] sh
 docker stop [container_name] (or [container-id])
docker start [container_name] (or [container-id])
 docker restart [container_name] (or [container-id])
 docker rm [container_name]
 docker logs [container_name] (or [container-id])
 docker inspect [container_name] (or [container-id])
docker cp [container]:/src /dest

docker-compose up
docker-compose up -d
docker-compose down
docker-compose build
docker-compose logs
docker-compose exec [service] bash

docker volume ls
docker volume create [name]
docker volume inspect [name]
docker volume rm [name]
docker run -v [vol]:/data [image]

docker network ls
docker network create [name]
docker network inspect [name]
docker network rm [name]
docker run --network [name] [image]

Git Cheat Sheet

HOME

git config --global user.name "<Your-Full-Name>"
git config --global user.email "<your-email-address>"

git init
git clone <repository_url>
git clone --branch <branch_name> <repo_url>

git status
git add <file1> <file2> … <fileN>
git add .
git rm <filename_or_dir>
 git diff [file]
git commit -m “[Commit message]”
git commit --amend -m "New commit message"

git branch
git branch -a
git branch [branch-name]
 git rebase [branch_name]
git checkout  [branch_name]
git checkout -b  [branch_name]
git switch -c  [branch_name]
git branch -d [branch_name]
git branch -D [branch_name]
git branch -m [branch_name]
git merge [branch_name]

git fetch [remote]
git push origin branch
git pull
git pull --rebase
git push --all
git remote
git remote add [name] [url]
git remote rm [remote]
git remote rename [old_name] [new_name]

git stash
git stash list
git stash pop
git stash drop

git log
git log --all
git diff
git log --author="Name"
git log --until="2024-12-31"
git log [file]
git show

Docker – Advance Level – Multiple Choice Questions and Answers – MCQ1

HOME

























Docker Tutorials

HOME

Docker – Basic Level – Multiple Choice Questions and Answers – MCQ1

HOME

























How to pass basic authorization token in header in Postman

Last Updated On

HOME

In this tutorial, we’ll learn how to use Postman to test an endpoint secured with Basic Authentication.

Table of Contents

What is an authorization token?

An authorization token, often referred to as an access token, is a piece of data or credential that is used to authenticate and authorize access to protected resources or operations in a system. It is a Base64-encoded string of username:password. We can send it in the Authorization header like this:

Authorization: Basic YWRtaW46cGFzc3dvcmQ=

We will use the following URL for this Postman tutorial.

https://postman-echo.com/basic-auth

Implementation Steps

Below are the steps to use Basic Auth in Postman:

Create a Collection

Step 1: Create a Collection, click on Collections, and then click on the “+” plus button.

Step 2:  Provide a name to the collection – “Authentication”.

Add a request to the Collection

Step 3: To create a new request, click on “Add a request”, if it is a new Collection. Otherwise, click on the 3 dots and select “Add request”.

Enter the details – URL, Method, Authorization

Step 4: Enter the “name” in the request. Here, the name is “Token”.

Step 5: Enter the “URL” in the address bar.

https://httpbin.org/basic-auth/user/pass

Step 6: Now, select the “GET” request from the list of request methods.


Step 9: Now, click on the Send button in Postman. The server will respond with the protected resource response message.

Verify the Response

Step 10: Once you press the send button, you will get the response from the server. Make sure you have a proper internet connection; otherwise, you will not get a response.

Status

You can check the status code. Here, we got the status code 200, which means we got a successful response to the request.

Body

In the Body tab of the response box, we have multiple options to see the response in a different format.

We are done! Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!!

Digest Authentication with Postman

Last Updated On

HOME

In this tutorial, we’ll learn how to use Postman to test an endpoint secured with Digest Authentication.

Table of Contents

What is Digest Authentication?

Digest Authentication is an advanced authentication method as compared to Basic Authentication. It is used in HTTP to secure the communication between the client and server. This authentication uses the hash of the password and other details rather than passing the actual password over the network. Using this Authentication method, we can make the communication more secure.

We will use the following URL for this Postman tutorial.

https://postman-echo.com/basic-auth

Implementation Steps

Below are the steps to use Basic Auth in Postman:

1. Create a Collection

Step 1: Create a Collection, click on Collections, and then click on the “+” plus button.

Step 2:  Provide a name to the collection – “Authentication”.

2. Add a request to the Collection

Step 3: To create a new request, click on “Add a request”, if it is a new Collection. Otherwise, click on the 3 dots and select “Add request”.

3. Enter the details – URL, Method, Authorization

Step 4: Enter the “name” in the request. Here, the name is “Digest Auth”.

Step 5: Enter the “URL” in the address bar.

https://postman-echo.com/digest-auth

Step 6: Now, select the “GET” request from the list of request methods.

4. Verify the Response

Step 10: Once you press the send button, you will get the response from the server. Make sure you have a proper internet connection; otherwise, you will not get a response.

4.1 Status

You can check the status code. Here, we got the status code 200, which means we got a successful response to the request.

4.2 Body

In the Body tab of the response box, we have multiple options to see the response in a different format.

4.3 Headers

Headers are the extra information that is transferred to the server or the client. In Postman, headers will show like key-value pairs under the headers tab. Click on the Headers link as shown in the below image:

We are done! Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!!