Programming Issues


At least one mapping is required (i.e. authorizeRequests().anyRequest().authenticated())

Spring Boot security is one of the most requested features in the application. Security controls the user access page on the basis of the configured roles. In this post, we analyze this simple exception “At least one mapping is required (i.e. authorizeRequests().anyRequest().authenticated())” and how this exception can be resolved. This

There was an unexpected error (type=Internal Server Error, status=500).

When a restful web service call is made to a Spring Boot MVC application, It shows error “Whitelabel Error Page – There was an unexpected error (type=Internal Server Error, status=500).” in the browser. The Internal Server Error is a popular error in spring boot application if a server side error

There is no PasswordEncoder mapped for the id “null”

The exception “java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id “null”” occurs if the spring boot application is enabled with security feature and password encoder is not configured for encryption. Spring boot application does not allow the password to be used as plain text. The password encoder is necessary

Using generated security password Spring Boot Security

The log “Using generated security password:” appears in the startup of the spring boot application. This log is due to default security configuration. This can be disabled, removed or customized using configurations. If the spring boot security dependency is added to pom.xml, the security authentication of the spring boot application

java.lang.IllegalArgumentException: Could not resolve placeholder ‘message’ in value “${message}”

The spring boot application failed at startup with the exception java.lang.IllegalArgumentException: Could not resolve placeholder ‘message’. This exception is due to a simple discrepancy between and the spring boot annotation with in your code. Spring boot application validates the @Value annotation in spring boot environments at Startup. If the

The absolute uri: cannot be resolved in either web.xml or the jar files deployed with this application

JSTL (JSP Standard tag library) supports common java operator functions, structural tasks including conditionals statements, looping structures. It also supports tags for editing XML documents, tags for localization and internationalization, and database operations like SQL query tags. Spring boot framework does not support jstl (JSP Standard tag library) tags by

“restartedMain” java.lang.reflect.InvocationTargetException: java.lang.AbstractMethodError

Spring boot application uses inversion of control to load all the dependency classes. Java supports the backward compatibility. If any issue occurred due to compatibility, the exception “java.lang.AbstractMethodError” will be thrown. In this post, the issue of java.lang.AbstractMethodError will be discussed Root Cause This problem occurs when some software is updated. If spring boot is upgraded to higher version

java.lang.AssertionError: Status expected: but was: in Junit test case Spring Boot

The Spring Boot MVC Controller returns a different HTTP status code compared to the intended HTTP status code in the Junit test case, then the Spring Boot Framework will throw this exception. Each status code indicates the type of the HTTP error. The issue will be resolved on the basis of the status code returned by the application server.  Root Cause The exception is thrown due

java.lang.AssertionError: Content type expected: but was: in Junit test case Spring Boot

We often see “Content type expected” error in unit test when testing spring boot MVC application. Spring boot test case makes a call to a web service.The Web service comes back with a response body. In response the test case expects content to be the same format. In Spring Boot,

java.lang.AssertionError: Content type not set in Junit test case Spring Boot

Junit test case returns “Content type not set” error when you are testing the Spring MVC Controller. The MVC controller returns a response that has no identified content type. The exception is as shown below. Root Cause The Junit test case expects the response content type while using the Spring

java.lang.AssertionError: No value at JSON path in JUnit

Spring boot MVC framework allows developers to write Junit test cases to test REST API. the rest api calls are tested using Junit with the help of MockMVC class. One of the common error in rest json is “No value at JSON path”. In this article, let us discuss on

java.lang.Exception No runnable methods

In spring boot junit test, the error “java.lang.Exception: No runnable methods” occurs because the junit framework does not find any test method with the @Test annotation in the test class. In the older version of the junit framework, the test method is identified with a method signature. The junit identifies

No qualifying bean of type ‘org.springframework.test.web.servlet.MockMvc’ available

In spring boot integration test, MockMvc throws NoSuchBeanDefinitionException on auto wire. MockMvc failed with an @autowired annotation in the spring boot test environment. In this article, we discuss the explanation for NoSuchBeanDefinitionExceptio: org.springframework.test.web.servlet.MockMvc, and the solution to fix this exception. Root Cause MockMvc is used to mock the mvc request

No qualifying bean of type org.springframework.web.context.WebApplicationContext available

WebApplicationContext creates a web environment to run a spring boot test class. If the WebApplicationContext bean is not available or is not created within the spring boot framework and the spring boot bean attempts to auto-wire this WebApplicationContext bean, this exception will be thrown by spring boot. Root Cause The

java.lang.IllegalArgumentException WebApplicationContext is required SpringRunner.class

In this post, we will explore the issue of loading the WebApplicationContext. The common issue is not loading the WebApplicationContext into the spring boot test environment. WebApplicationContext provides a web-based environment to run test cases. The WebApplicationContext is not required to run a spring boot console test. The web-based spring