Top Micronaut Interview Questions (2021) | CodeUsingJava
















Most frequently Asked Micronaut Interview Questions


  1. What is Micronaut?
  2. What are the various microservice used in Micronaut?
  3. How is Micronaut Framework licensed?
  4. What command-line tool is used by Micronaut?
  5. What are some commands used by Micronaut?
  6. How do we create CRUD application in Micronaut?
  7. How can we read application properties in Micronaut?
  8. How can we use spring data JPA with Micronaut?
  9. How can we Set Micronaut Context Path?
  10. How can we configure database for Integration tests in Micronaut?

What is Micronaut?

Micronaut is a full-stack microservice framework and has been developed by Grails Team to solve problems that have been identified by the years for building real World Microservice Applications. It is a JVM Framework that is used for developing microservices by using Kotlin, Java, and Groovy.

What are the various microservice used in Micronaut?

There are 3 types of microservices used in Micronaut:
  • Service Startup
  • Memory Footprint
  • Processing Throughput

How is Micronaut Framework licensed?

Micronaut framework is a project that is licensed by the Apache License V2. It includes code and documentation included in public repositories. The license does not include permission for using the word "Micronaut" or "Micronaut Logos and Trademark".

What command-line tool is used by Micronaut?

Command Line Tool used by Micronaut is known as mn.
$ mn --version
Micronaut version: 1.2.6
JVM version: 1.8.0_201


What are some commands used by Micronaut?

Commands used by Micronaut are as follows:
  • create app - helps in creating an application.
  • create cli app - helps in creating command line application.
  • create federation - helps by creating federation of the services.
  • create function - helpc by creating serverless function application.
  • create profile - helps by creating a profile.

How do we create CRUD application in Micronaut?

We can create CRUD Application by using the content of HomeController.java and by using the following command:
package Micro.world;import io.micronaut.HTTP.annotation.Controller;
import io.micronaut.HTTP.annotation.Get;
import io.micronaut.HTTP.HttpStatus;@Controller("/home")
 
public class HomeController {
 
@Get("/")
public HTTPStatus index() {
 return HTTPStatus.OK;
}
}


How can we read application properties in Micronaut?

We can read application properties by using aws.secretkeyid and microservices like:
Groovy
@Value('')
String keyId

Java
@Value("")
String keyId;

Kotlin
@Value("${aws.secretkeyid}")
keyId: String


How can we use spring data JPA with Micronaut?

We can use spring data JPA with Micronaut by using the following command:
@Repository
interface BookRepository extends CrudRepository<book, long> {
    book find(String title);
}


How can we Set Micronaut Context Path?

We can Set Micronaut Context Path by using the following command:
server:
  servlet:
    context-path: foo


How can we configure database for Integration tests in Micronaut?

We can configure database for Integration tests by using the following command:
@Repository
public interface helloRepository extends CrudRepository<Buffer Condition Entity, Long> {}