How to perform Exception Handling in Spring MVC / How to use @ExceptionHandler and @ControllerAdvice for exception handling in Spring

Exception handling is an integral part of any application. It involves catching errors and showing a graceful error message to the end user. Normally, try-catch blocks are used in a java application to handle exceptions where the error raised can be shown on a console or UI. But, in a web application, (more…)

Continue Reading

How to Autowire objects in Non-Spring classes / How to get Application context in Non-Spring classes / How to get access to the Spring application context In a non-Spring class

Scenario

Imagine you are working on a Spring application where most of the objects are created using Spring annotations and fields are also injected using Spring mechanisms (using @Autowired or XML configuration). Now you develop a component or use an API which is written without any use of Spring and you need one of your Spring managed classes in it. (more…)

Continue Reading
  • 1
  • 2
Close Menu