-1

What is the use of these properties in application.properties file and when do we use them?

spring.mvc.throw-exception-if-no-handler-found=true
spring.sources.add-mappings=false
aUserHimself
  • 1,589
  • 2
  • 17
  • 26
Toni
  • 33
  • 1
  • 4
  • 2
    https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html strg + f "spring.mvc.throw-exception-if-no-handler-found" => profit – Yannic Bürgmann Sep 20 '17 at 09:00

1 Answers1

0

According to these resources

  1. disable the static resource handling in Spring Boot

  2. Spring Boot application-properties

you can use

spring.resources.add-mappings=false

for disabling the default handling of classpath/ JAR/ file system resources (like css or image files) in case you would like to restrict access to them and create your own mappings

and

spring.mvc.throw-exception-if-no-handler-found=true

if you wish an exception of type NoHandlerFoundException to be thrown in case no handler is found in processing a request (and maybe catch it and take same appropriate action).

aUserHimself
  • 1,589
  • 2
  • 17
  • 26
  • You can disable the static resource handling by setting spring.resources.add-mappings=false in your application.properties. With that out of the way, are you sure that it will resolve your problem? Spring Security runs as a filter before the static resource handling and I doubt that disabling the resource handling will help. Perhaps it'll make it easier to identify the underlying problem, though. – Toni Sep 20 '17 at 10:38