0% found this document useful (0 votes)
4 views

Spring Boot

Spring Boot Actuator is a module that provides production-ready features for monitoring and managing Spring Boot applications through RESTful endpoints or JMX beans. Key annotations used in Spring Boot include @Autowired for dependency injection, @Transactional for transaction management, and @ExceptionHandler for handling exceptions. To secure Spring Boot applications, API key and secret authentication can be implemented, although more robust solutions like OAuth2 may be necessary for production environments.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Spring Boot

Spring Boot Actuator is a module that provides production-ready features for monitoring and managing Spring Boot applications through RESTful endpoints or JMX beans. Key annotations used in Spring Boot include @Autowired for dependency injection, @Transactional for transaction management, and @ExceptionHandler for handling exceptions. To secure Spring Boot applications, API key and secret authentication can be implemented, although more robust solutions like OAuth2 may be necessary for production environments.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1-What is Spring boot actuator?

Ans: Spring Boot Actuator is a module that provides production-ready features to monitor and
manage your Spring Boot application. It offers various endpoints and metrics that can be used for
monitoring, health checks, auditing, and managing your application. The actuator exposes these
features via RESTful endpoints or JMX (Java Management Extensions) beans.

To enable Spring Boot Actuator in the application, we need to add the spring-boot-starter-
actuator dependency to your project.

2-What spring boot annotations you have used?


Ans: --@Required:
--@Autowired: It is used to autowire spring bean on setter methods, instance variable, and
constructor.
When we use @Autowired annotation, the spring container auto-wires the bean by matching data-
type.
--@Bean, @Component, @Controller, @Service, @Repository
@EnableAutoConfiguration: It auto-configures the bean that is present in the classpath and configures
it to run the methods.
@SpringBootApplication:
@SpringBootApplication: It is a combination of three annotations
@EnableAutoConfiguration, @ComponentScan, and @Configuration.
@RequestMapping: It is used to map the web requests.

3-Can you tell me how we can handle the exception in Spring boot?
Ans: Use @ExceptionHandler Spring Boot provides the @ExceptionHandler annotation to handle
exceptions thrown by a specific controller method. This annotation can be used to provide
customized error responses for specific exceptions.

4- Can you tell me what happens behind the scene in Spring boot auto
configuration?
Ans: Spring Boot auto-configuration attempts to automatically configure your Spring application
based on the jar dependencies that you have added. For example, if HSQLDB is on your classpath,
and you have not manually configured any database connection beans, then Spring Boot auto
configures an in-memory database.

5-What is @Transcational annotation?


Ans: The @Transactional annotation is used to indicate that a method or a class should participate in
a transaction. It is used to ensure that a group of database operations are performed as a single unit
of work and that the database is left in a consistent state in case of any failures.

When a method is annotated with @Transactional, Spring creates a proxy around the method, and all
the database operations within the method are executed within the context of a transaction. Spring
also takes care of starting the transaction before the method is invoked and committing the
transaction after the method returns, or rolling back the transaction in case of an exception.

Q6-What are the Spring boot Exception you know?


Ans:

Error code Description

ERR001 General application issue

ERR002 IServer error

ERR003 Authentication error

ERR004 Resource not found

ERR005 Missing required information

ERR006 Invalid input

ERR007 Missing required field

ERR008 Inbox message not ready

ERR009 Session invalid or timeout

ERR010 Not supported

ERR013 IServer unreachable

ERR014 Insufficient privileges

ERR015 Object already exists


Error code Description

ERR016 Service not available

ERR017 Insufficient permission

ERR020 Dashboard prompt not supported

ERR021 Invalid configuration property

ERR022 Service TLS validation issue

ERR023 Secret Key configuration issue

ERR024 Trust store configuration issue

Q7-How to secure your spring boot Applications?


Securing a Spring Boot API with an API key and secret provides a straightforward way to authenticate
requests. It involves creating a custom filter, integrating it with Spring Security, and then configuring
your application to use these components.

Always consider the overall security of your application, especially in production, where more
robust solutions like OAuth2 might be more appropriate. With this guide, you should have a solid
foundation for adding API key and secret authentication to your Spring Boot applications.

You might also like