#Intellij unmapped spring configuration files found how to
That's all! Next we will look at how to actually implement Spring MVC. It will add a prefix and a suffix to what is returned by the controllersĪnd that way it determines which view to serve. Our InternalResourceViewResolver bean will do the actual mapping to the right jsp page.
The component scan will tell Spring to look for classes in the Controller package annotated with will talk more about this in the next tutorial, just remember that the request mappings go in there. Now all we need to configure here is the following Basic configuration should look like this: This file will contain instruction for retrieving the right views.
First, we need to add the spring-boot-configuration-processor dependency to our pom. Now let's take a look at what we have to do to fix this. But, if a property is unknown, IntelliJ will show us a warning: This is because, without metadata, IntelliJ cannot help us. Next thing on the to-do list is adding a xml file called dispatcher-servlet.xml to your WEB-INF folder. We can see a description, type, and an optional default value. I map it to the url pattern '/' because we want it to catch all incoming urls and '/*' seems to be buggy.ĭispatcher .DispatcherServlet contextConfigLocation /WEB-INF/dispatcher-servlet.xml 1 dispatcher / The dispatcherservlet can be compared to a frontcontroller that willīe responsible for mapping the incoming urls to the right jsp pages.
Only one thing left to do in the web.xml, we need to declare a dispatcherservlet. The ContextLoaderListener is responsible for loading the specified config files when your web application is starting. If you would like to pass more config files just separate them with a comma. In a web application you can tell Spring to load config files in the following way: Today we will be covering how to configure spring mvc in a web application.įirst off all let's configure our web.xml which at this point should look something like this Hello, welcome to part 6 of these series.