Spring Boot Unable to Load HTML (500 Error) - java

Let me start by saying I am currently getting this error when trying to load my Spring Boot app:
2022-07-04 15:26:03.640 DEBUG 15484 --- [nio-8881-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to com.gtt.gcaas.console.controller.ConsoleController#greeting()
2022-07-04 15:26:03.655 DEBUG 15484 --- [nio-8881-exec-1] o.s.web.servlet.DispatcherServlet : Failed to complete request: javax.servlet.ServletException: Could not resolve view with name 'welcome' in servlet with name 'dispatcherServlet'
2022-07-04 15:26:03.665 ERROR 15484 --- [nio-8881-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Could not resolve view with name 'welcome' in servlet with name 'dispatcherServlet'] with root cause
javax.servlet.ServletException: Could not resolve view with name 'welcome' in servlet with name 'dispatcherServlet'
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1380) ~[spring-webmvc-5.3.20.jar:5.3.20]
My Spring Main class is:
#SpringBootApplication
#ComponentScan(basePackages = {"com.gtt.gcaas.console.controller", "com.gtt.gcaas.device.details", "com.gtt.gcaas.device.root", "com.gtt.gcaas.device.db", "com.gtt.gcaas.device.db.service"})
#ConfigurationPropertiesScan(basePackages = {"com.gtt.gcaas.device.configuration"})
#EnableJpaRepositories(basePackages = {"com.gtt.gcaas.device.db.repository"})
#EnableWebMvc
#EntityScan(basePackages = {"com.gtt.gcaas.device.db.jpa"})
public class NcaasDeviceConnectionApplication {
public static void main(String[] args) {
SpringApplication.run(NcaasDeviceConnectionApplication.class, args);
}
}
My Controller Class is:
package com.gtt.gcaas.console.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
#Controller
public class ConsoleController {
#GetMapping("/greeting")
public String greeting() {
return "welcome";
}
}
I have declared this in my application.properties along with a few other hibernate properties:
logging.level.ch.qos.logback==DEBUG
spring.devtools.restart.enabled=true
debug=true
logging.file.path=C:/logs
spring.mvc.view.prefix=/WEB-INF/html/
spring.mvc.view.suffix=.html
But when I hit the URL http://localhost:8080/greeting I get the above error mentioned. First I tried with JAR packaging, but then switched to WAR, but the outcome is the same.
My folder structure is:
Any help on this would be nice. Thanks in advance.

Just put your welcome.html to /src/main/resources/WEB-INF/html/ and add the following properties to the application.properties :
spring.mvc.view.suffix=.html
spring.web.resources.static-locations=classpath:/WEB-INF/html
Usually there's not need to set the static resource locations, since there are some predefined/well-known ones:
By default, Spring Boot serves static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath or from the root of the ServletContext.
(https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#web.servlet.spring-mvc.static-content)
I.e. if you put your static resources in any of those directories under src/main/resources Spring will see them.

Related

datadog.apiKey was 'null' but it is required

I am currently using spring boot 2.7.0-M1 and following is my dependencies in build.gradle:
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.boot:spring-boot-starter-cache'
compileOnly 'org.projectlombok:lombok'
implementation 'org.springframework.cloud:spring-cloud-starter-bootstrap'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
implementation 'io.micrometer:micrometer-registry-datadog:latest.release'
datadogagent("com.datadoghq:dd-java-agent:$datadoghq_dd_version")
implementation("com.datadoghq:dd-trace-api:${datadoghq_dd_version}")
However, when i try to set micrometer bean:
#Configuration
public class MeterRegistryConfig {
#Bean
MeterRegistry meterRegistry(ApplicationContext context) {
DatadogConfig config = new DatadogConfig() {
#Override
public Duration step() {
return Duration.ofSeconds(10);
}
#Override
public String get(String k) {
return null; // accept the rest of the defaults
}
};
return new DatadogMeterRegistry(config, Clock.SYSTEM);
}
}
I am getting a startup error:
2022-02-05 05:07:56.457 ERROR 7897 --- [ restartedMain] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webMvcMetricsFilter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcMetricsFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/CompositeMeterRegistryConfiguration.class]: Unsatisfied dependency expressed through method 'compositeMeterRegistry' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'meterRegistry' defined in class path resource [com/hbomax/ml/mlsvc/config/MeterRegistryConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [io.micrometer.core.instrument.MeterRegistry]: Factory method 'meterRegistry' threw exception; nested exception is io.micrometer.core.instrument.config.validate.ValidationException: datadog.apiKey was 'null' but it is required
2022-02-05 05:07:56.504 INFO 7897 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-02-05 05:07:56.520 WARN 7897 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2022-02-05 05:07:56.541 INFO 7897 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Here's my application.yaml:
management:
info:
git:
mode: full
metrics:
distribution:
percentiles:
http:
server:
requests: 0.5, 0.95, 0.99
percentiles-histogram:
http:
server:
requests: true
sla:
http:
server:
requests: 200ms, 400ms, 600ms
export:
datadog:
step: 30s
enabled: true
api-key: xxxxxxx
tags:
application: ${spring.application.name}
env: ${spring.profiles}
Can someone help me understand what is the issue? I tried searching around but din't get any solution. I tried replacing api-key with apiKey(I know it's silly) but no success.
Any help folks?
You are using Spring Boot's configuration properties in application.yml but you are also making your own DatadogMeterRegistry that doesn't use those configuration properties, and therefore it will not have the required API key configuration.
You can delete the MeterRegistryConfig class entirely and instead use the DatadogMeterRegistry that Spring Boot will auto-configure from configuration properties because you have the micrometer-registry-datadog dependency on your classpath. See this section of the Spring Boot documentation.
For me, it was just the hierarchy is changed when updated from Spring boot 2 -> 3.
Update the below:
management:
.....
metrics: // Changed to datadog
.....
export: // Changed to metrics
datadog: // Changed to export
step: 30s
enabled: true
api-key: xxxxxxx
.....
To :
management:
.....
datadog:
.....
metrics:
export:
step: 30s
enabled: true
api-key: xxxxxxx
.....

Inject property into applicationContext.xml as value (spring boot 2.2)

I am trying to inject a property into my applicationContext.xml file in my spring boot project:
Application file :
#SpringBootApplication
#PropertySource("classpath:navi.properties") // <== injection here
#ImportResource({"classpath*:applicationContext.xml"}) // <== load the xml setting file
public class CApplication {
public static void main(String[] args) {
SpringApplication.run(CApplication.class, args);
}
}
As you can see, nothing fancy here... In my src/main/resources/navi.properties file :
USER_INFO_CLS=jp.co.xxx.yyy.fw.service.UserInfoService
in my applicationContext.xml, I am trying to inject this value :
<bean id="userInfoService" class="${USER_INFO_CLS}"/>
But ./mvnw spring-boot:run returns the error below :
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [${USER_INFO_CLS}] for bean with name 'userInfoService' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: ${USER_INFO_CLS}
I read many articles about it (like this one) and it sounds good....
Thanks

Spring Boot can't find profile-specific properties files

I am following Spring documentation to use profile specific property files for my SpringBoot app. I have 2 property files under src/main/resources : datasource.properties for local development and datasource-prod.properties for server datasource config.
This is my DataSourceConfiguration.java config class :
#Configuration
#PropertySource("classpath:datasource-{profile}.properties")
#Slf4j
public class DataSourceConfiguration {
#Value("${flad.datasource.driver}")
private String dataSourceDriverClassName;
#Value("${flad.datasource.url}")
private String dataSourceUrl;
#Value("${flad.datasource.username}")
private String dataSourceUsername;
#Value("${flad.datasource.password}")
private String dataSourcePassword;
#Bean
public DataSource getDataBase(){
log.info("Datasource URL = {}", dataSourceUrl);
return DataSourceBuilder
.create()
.driverClassName(dataSourceDriverClassName)
.url(dataSourceUrl)
.username(dataSourceUsername)
.password(dataSourcePassword)
.build();
}
}
When I launch my SpringBootApplication main class I get the following error whether I use -Dspring.profiles.active=prod or not :
17:05:49.008 [restartedMain] ERROR org.springframework.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [fr.payet.flad.core.config.CoreConfig]; nested exception is java.io.FileNotFoundException: class path resource [datasource-{profile}.properties] cannot be opened because it does not exist
The solution that I found is to rename my property files datasource-local.properties and datasource-prod.properties, use #PropertySource this way #PropertySource("classpath:datasource-${profile}.properties") and when I launch my SpringBoot app I use -Dprofile=local as VM options

Spring Boot Controller not mapping

I have used STS and now I am using IntelliJ Ultimate Edition but I am still getting the same output. My controller is not getting mapped thus showing 404 error. I am completely new to Spring Framework.
DemoApplication.java
package com.webservice.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
#SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
HelloController.java
package com.webservice.demo;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
#RestController
public class HelloController {
#RequestMapping("/hello")
public String sayHello(){
return "Hey";
}
}
Console Output
com.webservice.demo.DemoApplication : Starting DemoApplication on XFT000159365001 with PID 11708 (started by Mayank Khursija in C:\Users\Mayank Khursija\IdeaProjects\demo)
2017-07-19 12:59:46.150 INFO 11708 --- [ main] com.webservice.demo.DemoApplication : No active profile set, falling back to default profiles: default
2017-07-19 12:59:46.218 INFO 11708 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#238e3f: startup date [Wed Jul 19 12:59:46 IST 2017]; root of context hierarchy
2017-07-19 12:59:47.821 INFO 11708 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8211 (http)
2017-07-19 12:59:47.832 INFO 11708 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2017-07-19 12:59:47.832 INFO 11708 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.15
2017-07-19 12:59:47.944 INFO 11708 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2017-07-19 12:59:47.944 INFO 11708 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1728 ms
2017-07-19 12:59:47.987 INFO 11708 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2017-07-19 12:59:48.510 INFO 11708 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-07-19 12:59:48.519 INFO 11708 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2017-07-19 12:59:48.634 INFO 11708 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8211 (http)
2017-07-19 12:59:48.638 INFO 11708 --- [ main] com.webservice.demo.DemoApplication : Started DemoApplication in 2.869 seconds (JVM running for 3.44)
I too had the similar issue and was able to finally resolve it by correcting the source package structure following this
Your Controller classes are not scanned by the Component scanning. Your Controller classes must be nested below in package hierarchy to the main SpringApplication class having the main() method, then only it will be scanned and you should also see the RequestMappings listed in the console output while Spring Boot is getting started.
Tested on Spring Boot 1.5.8.RELEASE
But in case you prefer to use your own packaging structure, you can always use the #ComponentScan annotation to define your basePackages to scan.
Because of DemoApplication.class and HelloController.class in the same package
Locate your main application class in a root package above other classes
Take look at Spring Boot documentation Locating the Main Application Class
Using a root package also allows component scan to apply only on your
project.
For example, in your case it looks like below:
com.webservice.demo.DemoApplication
com.webservice.demo.controller.HelloController
In my case, it was missing the dependency from pom.xml, otherwise everything compiled just fine. The 404 and missing mappings info from Spring logs were the only hints.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
I also had trouble with a similar issue and resolved it using the correct package structure as per below. After correction, it is working properly.
e.g.
Spring Application Main Class is in package com.example
Controller Classes are in package com.example.controller
Adding #ComponentScan(com.webservice) in main class above #SpringBootApplication will resolve your problem. Refer below code
package com.webservice.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
#ComponentScan(com.webservice)
#SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
In my case, I was using #Controller instead of #RestController with #RequestMapping
In my opinion, this visibility problem comes when we leave the component scan to Spring which has a particular way of looking for the classes using standard convention.
In this scenario as the Starter class(DemoApplication)is in com.webservice.demo package, putting Controller one level below will help Spring to find the classes using the default component scan mechanism. Putting HelloController under com.webservice.demo.controller should solve the issue.
It depends on a couple of properties:
server.contextPath property in application properties. If it's set to any value then you need to append that in your request url. If there is no such property then add this line in application.properties server.contextPath=/
method property in #RequestMapping, there does not seem to be any value and hence, as per documentation, it should map to all the methods. However, if you want it to listen to any particular method then you can set it to let's say method = HttpMethod.GET
I found the answer to this. This was occurring because of security configuration which is updated in newer versions of Spring Framework. So i just changed my version from 1.5.4 to 1.3.2
In my case I used wrong port for test request - Tomcat was started with several ones exposed (including one for monitoring /actuator).
In my case I changed the package of configuration file. Moved it back to the original com.example.demo package and things started working.
Another case might be that you accidentally put a Java class in a Kotlin sources directory as I did.
Wrong:
src/main
┕ kotlin ← this is wrong for Java
┕ com
┕ example
┕ web
┕ Controller.class
Correct:
src/main
┕ java ← changed 'kotlin' to 'java'
┕ com
┕ example
┕ web
┕ Controller.class
Because when in Kotlin sources directory, Java class won't get picked up.
All other packages should be an extension of parent package then only spring boot app will scan them by default.
Other option will be to use #ComponentScan(com.webservice)
package structure
👋 I set up 🍃Spring Boot Security in Maven deps. And it automatically deny access to unlogged users also for login page if you haven't change rules for it.
So I prefered my own security system and deleted this dependency.🤓
If you want to use Spring Security. You can wrote WebSecurityConfig like this:
#Configuration
#EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
#Autowired
UserService userService;
#Bean
public BCryptPasswordEncoder bCryptPasswordEncoder() {
return new BCryptPasswordEncoder();
}
#Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
.csrf()
.disable()
.authorizeRequests()
//Доступ только для не зарегистрированных пользователей
.antMatchers("/registration").not().fullyAuthenticated()
//Доступ только для пользователей с ролью Администратор
.antMatchers("/admin/**").hasRole("ADMIN")
.antMatchers("/news").hasRole("USER")
//Доступ разрешен всем пользователей
.antMatchers("/", "/resources/**").permitAll()
//Все остальные страницы требуют аутентификации
.anyRequest().authenticated()
.and()
//Настройка для входа в систему
.formLogin()
.loginPage("/login")
//Перенарпавление на главную страницу после успешного входа
.defaultSuccessUrl("/")
.permitAll()
.and()
.logout()
.permitAll()
.logoutSuccessUrl("/");
}
#Autowired
protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userService).passwordEncoder(bCryptPasswordEncoder());
}
}
from [https://habr.com/ru/post/482552/] (in russian)

Spring Boot Not Able to Resolve Static Content

So after adding Spring Security (not sure if it is the cause) it appears not only are the default Static Content resolution path null and void, but also any subsequent attempts to map URLs to static content
For example, a vanilla Spring Boot Application without a WebSecurityConfigurerAdapter would map /GET localhost:8080/index.html to ResourceHttpRequestHandler with default configured static content locations such as classpath:META-INF/resources and classpath:static/
Thus index.html located in one of these classpath locations are automatically served.
With a WebSecurityConfigurerAdapter however, I get 405s ... and no matter what I do ... it appears the handler registry will not contain a mapping to the aforementioned ResourceHttpRequestHandler locations
For example
Attempt to Add mapping explicitly
Use ResourceHandlerRegistry
#Configuration
public class ServletConfiguration extends WebMvcConfigurerAdapter {
#Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/index.html").addResourceLocations("classpath:statc/index.html");
super.addResourceHandlers(registry);
}
}
Here are the TRACE logs
2017-07-17 12:12:21.742 DEBUG 23566 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/]
2017-07-17 12:12:21.755 DEBUG 23566 --- [nio-8080-exec-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /
2017-07-17 12:12:21.760 DEBUG 23566 --- [nio-8080-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Resolving exception from handler [null]: org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'GET' not supported
2017-07-17 12:12:21.768 DEBUG 23566 --- [nio-8080-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Invoking #ExceptionHandler method: public final org.springframework.http.ResponseEntity<java.lang.Object> org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler.handleException(java.lang.Exception,org.springframework.web.context.request.WebRequest)
Is this a known and frequently encountered issue when dealing with Spring Security?
Or maybe this is not expected and unrelated to Spring Security? I've gotten the entire setup to work many times before, the only thing new is Spring Security
Here is the SecurityConfiguration
#Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
#Autowired
private UserDetailService userDetailsService;
#Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
final DaoAuthenticationProvider daoAuthenticationProvider = new DaoAuthenticationProvider();
daoAuthenticationProvider.setPasswordEncoder(new StandardPasswordEncoder());
daoAuthenticationProvider.setUserDetailsService(userDetailsService);
/*
it is important to set the default userDetailsService on AuthenticationManagerBuilder
*/
auth.authenticationProvider(daoAuthenticationProvider).userDetailsService(userDetailsService);
}
#Override
protected void configure(HttpSecurity http) throws Exception {
org.springframework.security.web.authentication.AuthenticationSuccessHandler authenticationSuccessHandler = new AuthenticationSuccessHandler();
http
.csrf()
.disable()
.exceptionHandling()
.authenticationEntryPoint(new HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED))
.and()
.authorizeRequests()
.antMatchers("/index.html").permitAll()
.antMatchers("/api/security/**")
.hasAuthority("ADMIN")
.antMatchers("/api/portfolios/**", "/api/trades/**", "/api/user/**", "/api/init")
.authenticated()
.and()
.formLogin()
.successHandler(authenticationSuccessHandler)
.failureHandler(new SimpleUrlAuthenticationFailureHandler())
.and()
.rememberMe()
.and()
.logout()
.logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler(HttpStatus.OK));
}
}
Note that the start-up logs show both the default static content handler mapping and my explicit mapping to be both present and configured ... they are just not there when the actual request is made:
2017-07-17 12:25:57.088 DEBUG 23702 --- [ main] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/**/favicon.ico", locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], class path resource []], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#23707d5d]
2017-07-17 12:25:57.089 DEBUG 23702 --- [ main] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/index.html", locations=[class path resource [statc/index.html]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#5fa49615]
2017-07-17 12:25:57.089 DEBUG 23702 --- [ main] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/webjars/**", locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#7921eb37]
2017-07-17 12:25:57.089 DEBUG 23702 --- [ main] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/**", locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#3fdb9c55]
EDIT
Digging Deeper
It appears there is a PartialMatchHelper in RequestMappingInfoHandlerMapping.java:195 on URL:[], method: PUT which will match every single request!
Kind of small mistake on my part - but has huge implications (after learning how Spring MVC framework works internally)
I had accidentally added a controller like this
#RestController("registration")
public class RegistrationController { ... }
When I meant
#RestController
#RequestMapping("registration")
public class RegistrationController {...}
so my registration REST end point would not have worked ... clearly BUT ... the former configuration also unwitting affected static content resolution by placing an empty URL:[], METHOD: PUT/POST or whatever into RequestMappingHandlerMapping which is one of the handler mappings that can take precedence over static Resource mappings
So the moral of the story is:
debug DispatcherServlet.java to see which handler mapping is truly being used

Categories