Programming Issues

Issues

CONDITION EVALUATION DELTA spring boot console log Positive matches Negative matches Exclusions Unconditional classes

CONDITION EVALUATION DELTA is a feature by spring boot developer tool which evaluates bean changes. The spring boot developer tool evaluate the spring boot application on inititalization. CONDITION EVALUATION DELTA comprises four types of information namely Positive matches, Negative matches, Exclusions and Unconditional classes On every restart, spring boot application shows

@ConditionalOnMissingBean did not find any beans (OnBeanCondition)

The spring boot application runs on auto configuration mode. On a configuration change, that matches a dependent class but not loaded in the bean factory. Auto Configuration Report Root Cause If the spring boot application configuration has changed and if @ConditionalOnMissingBean matches the condition and the bean is not loaded

ConditionalOnClass found required class

If auto configuration is enabled in spring boot application and the ConditionalOnClass property is modified, the dependent class shows in auto configuration report Auto Configuration Report Negative matches: JpaBaseConfiguration.JpaWebConfiguration: Did not match: - @ConditionalOnProperty (spring.jpa.open-in-view=true) found different value in property 'open-in-view' (OnPropertyCondition) Matched: - @ConditionalOnClass found required class 'org.springframework.web.servlet.config.annotation.WebMvcConfigurer' (OnClassCondition)

ConditionalOnProperty found different open-in-view

If spring boot application is running and any of the property configuration is modified in configuration files like application.properties, This auto configuration report will be shown in console log. Auto Configuration Report Negative matches: JpaBaseConfiguration.JpaWebConfiguration: Did not match: - @ConditionalOnProperty (spring.jpa.open-in-view=true) found different value in property 'open-in-view' (OnPropertyCondition) Positive matches:

spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this

In Spring boot, by default OSIV (Open Session in View) is enabled. As OSIV affects the connection and performance of the database, this warning log will be displayed when starting the spring boot application. Exception 2019-10-05 16:32:06.548 WARN 3840 --- [ restartedMain] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore,

java.util.NoSuchElementException: No value present

This error “Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.util.NoSuchElementException: No value present]” occurred in spring boot application when an entity object is being attempted to get it from an optional object. If the hibernate returns an empty optional object,

Request method ‘GET’ not supported – Http Status 405

In spring boot, if the requested url is not configured as ‘GET’ call in rest controller, PageNotFound : Request method ‘GET’ not supported exception will be thrown from the application. It also throws org.springframework.web.HttpRequestMethodNotSupportedException: Request method ‘GET’ not supported in spring boot as the method is not available in spring

No default constructor for entity

The spring boot error No default constructor for entity occurs in an entity class which does not have a default constructor. The hibernate uses the default constructor method to create a bean class. Hibernate fails to create entity classes unless there is a default constructor. Therefore, throws exception org.hibernate.InstantiationException: No entity default constructor. The default constructor is

Required string parameter is not present

The spring boot error Required string parameter is not present occurs when the request parameter is not stated in the request url and the request parameter is configured as mandatory. The controller method needs to provide a value for the request parameter. The invoked url does not contain the value

template might not exist or might not be accessible by any of the configured Template Resolvers

The spring boot error template might not exist or might not be accessible by any of the configured Template Resolvers occurs when the template files are not available in src/main/resources/templates folder or the file name is incorrect. The exception org.thymeleaf.exceptions.TemplateInputException: Error resolving template is thrown if the template file can

Path with “WEB-INF” or “META-INF”

The spring boot error Path with “WEB-INF” or “META-INF” occurs when the jsp page url is invoked and the tomcat jasper dependency is not configured in the application. The jsp files are compiled and rendered using the tomcat embedded jasper maven dependency. If the maven dependency is not configured in

javax.servlet.ServletException: Circular view path [error]: would dispatch back to the current handler URL [/error] again.

The spring boot exception javax.servlet.ServletException: Circular view path [error]: would dispatch back to the current handler URL [/error] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.) occurs when the default error url is disabled or an error

Ambiguous mapping. Cannot map ‘basicErrorController’ method

Spring boot error Ambiguous mapping. Cannot map ‘basicErrorController’ method occurs when the url ‘/error’ url is configured in the request mapping annotation of the rest controller method. By default, “/error” is mapped in the BasicErrorController class to handle errors and exceptions in the spring boot application. This error occurs when

This application has no explicit mapping for /error, so you are seeing this as a fallback. Whitelabel error page

In this post, we will see about this error “Whitelabel Error page, This application has no explicit mapping for /error, so you are seeing this as a fallback.”. You see this error, because something went wrong in the application. For some reason, Spring boot can not server the web page

Web server failed to start. Port 8080 was already in use.

The spring boot Web server failed to start. Port 8080 was already in use. error occurs because port 8080 is already configured with another application, or port 8080 has not been released yet. The spring boot application is trying to configure port 8080 to start a web server. Since the