Spring - web.xml not correctly including url-pattern declarations











up vote
0
down vote

favorite












I'm trying to make a GET request on Spring MVC, which is replying me a 404 and the warning



WARN (org.springframework.web.servlet.PageNotFound) - No mapping found for HTTP request with URI [/bo/newsletter/api/104] in DispatcherServlet with name 'dispatcher'


I'm 90% sure the problem is coming from my web.xml, as I will explain soon.



Here is my RestController :



@RequestMapping("newsletter/api")
@RestController
public class NewsletterRestController {

@Autowired
INewsletterService newsletterService;

@Autowired
public NewsletterRestController(INewsletterService newsletterService) {
this.newsletterService = newsletterService;
}

@InitBinder
public void initBinder(final WebDataBinder binder) {
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

@PutMapping
public ResponseEntity sendNews(
@RequestBody Newsletter news,
final User user) throws IOException {
news.setLastUserId(user.getId());
newsletterService.saveNewsletter(user, news);
return new ResponseEntity(HttpStatus.CREATED);
}

@GetMapping("/{id}")
public Newsletter getNewsletter(@PathVariable Long id) {
return newsletterService.getOneNewsletter(id);
}

}


And here is my web.xml (more precisely the interesting part) :



<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/applicationContext-model.xml,

classpath:spring/applicationContext-mail.xml,

classpath:spring/applicationContext-dbcp.xml,
classpath:spring/applicationContext-dao.xml,
classpath:spring/applicationContext-service.xml,

classpath:spring/applicationContext-taxref-dbcp.xml,
classpath:spring/applicationContext-taxref-dao.xml,
classpath:spring/applicationContext-taxref-service.xml,

classpath:spring/applicationContext-security-bo.xml,
classpath:spring/dispatcher-servlet.xml
</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/dispatcher-servlet.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/newsletter/api/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/newsletter/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/index/*</url-pattern>
</servlet-mapping>


The interesting thing is that if I modify the /newsletter/api/* <url-pattern> to /newsletter/api/104 (if I'm trying to get the id 104, for example), the GET request works as a charm.



The problem is that I thought that put, as a url-pattern, in this case /newsletter/* would reasonably cover every extension of /newsletter url.



Any suggestion ?



Thanks by advance,



--
Denis










share|improve this question


















  • 1




    You shouldn't map that URL. The URL on the controller is the URL as inside the DispatcherServlet so currently it would be /newsletter/api/newsletter/api/104. In fact you should map your servlet to / instead of all of the partial URLs you have in your controllers. Non related but you are loading your dispatcher-servlet.xml twice, leading to memory pollution. Remove the one that is loaded by the ContextLoaderListener.
    – M. Deinum
    Nov 22 at 18:52












  • I think I see what you mean. But this project is an old one, and the structure is the same for each servlet, as you can see for index and newsletter inside the web.xml. That may be stupid, but I'ld like to keep it that way. I don't know if you have any further suggestion to apply to that case. Plus I did not understand the second part of your comment ; where may I remove the dispatcher-servlet loaded by the ContextLoaderListener ?
    – Denis Lebon
    Nov 23 at 9:19












  • In your web.xml both the ContextLoaderListener and DispatcherServlet are loading the same xml. This effectively loads your application twice. Your solution is simply not going to work. The path resolved is always inside the servlet so the part that you use for mapping is ignored. Also do you really want that, this means that for each path you add you need to break open your web.xml which is hardly maintainable. You could configure the RequestMappingHandlerMapping to use the full path to resolve instead of a path inside the DispatcherServlet but I suggest to not go that path.
    – M. Deinum
    Nov 23 at 12:02










  • I'm sorry to be that noobish, but I can't figure out how to solve the ContextLoaderListener problem. Tried to delete it but then application won't work. What do you more precisely mean ? Doc on the subject didn't help me either. For the other part, I'll check with my boss what way should we take. Don't want to modify things I didn't code too hard !
    – Denis Lebon
    Nov 23 at 14:23












  • There is a list of xml files loaded by the ContextLoaderListener, the context-param named contextConfigLocation this list contains the dispatcher-servlet.xml. Which means everything in there gets loaded by both the ContextLoaderLIstner as well as the DispatcherServlet. Hence you are loading all your web related beans twice with no additional benefit.
    – M. Deinum
    Nov 24 at 18:03















up vote
0
down vote

favorite












I'm trying to make a GET request on Spring MVC, which is replying me a 404 and the warning



WARN (org.springframework.web.servlet.PageNotFound) - No mapping found for HTTP request with URI [/bo/newsletter/api/104] in DispatcherServlet with name 'dispatcher'


I'm 90% sure the problem is coming from my web.xml, as I will explain soon.



Here is my RestController :



@RequestMapping("newsletter/api")
@RestController
public class NewsletterRestController {

@Autowired
INewsletterService newsletterService;

@Autowired
public NewsletterRestController(INewsletterService newsletterService) {
this.newsletterService = newsletterService;
}

@InitBinder
public void initBinder(final WebDataBinder binder) {
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

@PutMapping
public ResponseEntity sendNews(
@RequestBody Newsletter news,
final User user) throws IOException {
news.setLastUserId(user.getId());
newsletterService.saveNewsletter(user, news);
return new ResponseEntity(HttpStatus.CREATED);
}

@GetMapping("/{id}")
public Newsletter getNewsletter(@PathVariable Long id) {
return newsletterService.getOneNewsletter(id);
}

}


And here is my web.xml (more precisely the interesting part) :



<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/applicationContext-model.xml,

classpath:spring/applicationContext-mail.xml,

classpath:spring/applicationContext-dbcp.xml,
classpath:spring/applicationContext-dao.xml,
classpath:spring/applicationContext-service.xml,

classpath:spring/applicationContext-taxref-dbcp.xml,
classpath:spring/applicationContext-taxref-dao.xml,
classpath:spring/applicationContext-taxref-service.xml,

classpath:spring/applicationContext-security-bo.xml,
classpath:spring/dispatcher-servlet.xml
</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/dispatcher-servlet.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/newsletter/api/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/newsletter/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/index/*</url-pattern>
</servlet-mapping>


The interesting thing is that if I modify the /newsletter/api/* <url-pattern> to /newsletter/api/104 (if I'm trying to get the id 104, for example), the GET request works as a charm.



The problem is that I thought that put, as a url-pattern, in this case /newsletter/* would reasonably cover every extension of /newsletter url.



Any suggestion ?



Thanks by advance,



--
Denis










share|improve this question


















  • 1




    You shouldn't map that URL. The URL on the controller is the URL as inside the DispatcherServlet so currently it would be /newsletter/api/newsletter/api/104. In fact you should map your servlet to / instead of all of the partial URLs you have in your controllers. Non related but you are loading your dispatcher-servlet.xml twice, leading to memory pollution. Remove the one that is loaded by the ContextLoaderListener.
    – M. Deinum
    Nov 22 at 18:52












  • I think I see what you mean. But this project is an old one, and the structure is the same for each servlet, as you can see for index and newsletter inside the web.xml. That may be stupid, but I'ld like to keep it that way. I don't know if you have any further suggestion to apply to that case. Plus I did not understand the second part of your comment ; where may I remove the dispatcher-servlet loaded by the ContextLoaderListener ?
    – Denis Lebon
    Nov 23 at 9:19












  • In your web.xml both the ContextLoaderListener and DispatcherServlet are loading the same xml. This effectively loads your application twice. Your solution is simply not going to work. The path resolved is always inside the servlet so the part that you use for mapping is ignored. Also do you really want that, this means that for each path you add you need to break open your web.xml which is hardly maintainable. You could configure the RequestMappingHandlerMapping to use the full path to resolve instead of a path inside the DispatcherServlet but I suggest to not go that path.
    – M. Deinum
    Nov 23 at 12:02










  • I'm sorry to be that noobish, but I can't figure out how to solve the ContextLoaderListener problem. Tried to delete it but then application won't work. What do you more precisely mean ? Doc on the subject didn't help me either. For the other part, I'll check with my boss what way should we take. Don't want to modify things I didn't code too hard !
    – Denis Lebon
    Nov 23 at 14:23












  • There is a list of xml files loaded by the ContextLoaderListener, the context-param named contextConfigLocation this list contains the dispatcher-servlet.xml. Which means everything in there gets loaded by both the ContextLoaderLIstner as well as the DispatcherServlet. Hence you are loading all your web related beans twice with no additional benefit.
    – M. Deinum
    Nov 24 at 18:03













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm trying to make a GET request on Spring MVC, which is replying me a 404 and the warning



WARN (org.springframework.web.servlet.PageNotFound) - No mapping found for HTTP request with URI [/bo/newsletter/api/104] in DispatcherServlet with name 'dispatcher'


I'm 90% sure the problem is coming from my web.xml, as I will explain soon.



Here is my RestController :



@RequestMapping("newsletter/api")
@RestController
public class NewsletterRestController {

@Autowired
INewsletterService newsletterService;

@Autowired
public NewsletterRestController(INewsletterService newsletterService) {
this.newsletterService = newsletterService;
}

@InitBinder
public void initBinder(final WebDataBinder binder) {
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

@PutMapping
public ResponseEntity sendNews(
@RequestBody Newsletter news,
final User user) throws IOException {
news.setLastUserId(user.getId());
newsletterService.saveNewsletter(user, news);
return new ResponseEntity(HttpStatus.CREATED);
}

@GetMapping("/{id}")
public Newsletter getNewsletter(@PathVariable Long id) {
return newsletterService.getOneNewsletter(id);
}

}


And here is my web.xml (more precisely the interesting part) :



<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/applicationContext-model.xml,

classpath:spring/applicationContext-mail.xml,

classpath:spring/applicationContext-dbcp.xml,
classpath:spring/applicationContext-dao.xml,
classpath:spring/applicationContext-service.xml,

classpath:spring/applicationContext-taxref-dbcp.xml,
classpath:spring/applicationContext-taxref-dao.xml,
classpath:spring/applicationContext-taxref-service.xml,

classpath:spring/applicationContext-security-bo.xml,
classpath:spring/dispatcher-servlet.xml
</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/dispatcher-servlet.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/newsletter/api/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/newsletter/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/index/*</url-pattern>
</servlet-mapping>


The interesting thing is that if I modify the /newsletter/api/* <url-pattern> to /newsletter/api/104 (if I'm trying to get the id 104, for example), the GET request works as a charm.



The problem is that I thought that put, as a url-pattern, in this case /newsletter/* would reasonably cover every extension of /newsletter url.



Any suggestion ?



Thanks by advance,



--
Denis










share|improve this question













I'm trying to make a GET request on Spring MVC, which is replying me a 404 and the warning



WARN (org.springframework.web.servlet.PageNotFound) - No mapping found for HTTP request with URI [/bo/newsletter/api/104] in DispatcherServlet with name 'dispatcher'


I'm 90% sure the problem is coming from my web.xml, as I will explain soon.



Here is my RestController :



@RequestMapping("newsletter/api")
@RestController
public class NewsletterRestController {

@Autowired
INewsletterService newsletterService;

@Autowired
public NewsletterRestController(INewsletterService newsletterService) {
this.newsletterService = newsletterService;
}

@InitBinder
public void initBinder(final WebDataBinder binder) {
binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
}

@PutMapping
public ResponseEntity sendNews(
@RequestBody Newsletter news,
final User user) throws IOException {
news.setLastUserId(user.getId());
newsletterService.saveNewsletter(user, news);
return new ResponseEntity(HttpStatus.CREATED);
}

@GetMapping("/{id}")
public Newsletter getNewsletter(@PathVariable Long id) {
return newsletterService.getOneNewsletter(id);
}

}


And here is my web.xml (more precisely the interesting part) :



<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee>

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/applicationContext-model.xml,

classpath:spring/applicationContext-mail.xml,

classpath:spring/applicationContext-dbcp.xml,
classpath:spring/applicationContext-dao.xml,
classpath:spring/applicationContext-service.xml,

classpath:spring/applicationContext-taxref-dbcp.xml,
classpath:spring/applicationContext-taxref-dao.xml,
classpath:spring/applicationContext-taxref-service.xml,

classpath:spring/applicationContext-security-bo.xml,
classpath:spring/dispatcher-servlet.xml
</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:spring/dispatcher-servlet.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/newsletter/api/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/newsletter/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/index/*</url-pattern>
</servlet-mapping>


The interesting thing is that if I modify the /newsletter/api/* <url-pattern> to /newsletter/api/104 (if I'm trying to get the id 104, for example), the GET request works as a charm.



The problem is that I thought that put, as a url-pattern, in this case /newsletter/* would reasonably cover every extension of /newsletter url.



Any suggestion ?



Thanks by advance,



--
Denis







java spring spring-mvc






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 at 15:45









Denis Lebon

12




12








  • 1




    You shouldn't map that URL. The URL on the controller is the URL as inside the DispatcherServlet so currently it would be /newsletter/api/newsletter/api/104. In fact you should map your servlet to / instead of all of the partial URLs you have in your controllers. Non related but you are loading your dispatcher-servlet.xml twice, leading to memory pollution. Remove the one that is loaded by the ContextLoaderListener.
    – M. Deinum
    Nov 22 at 18:52












  • I think I see what you mean. But this project is an old one, and the structure is the same for each servlet, as you can see for index and newsletter inside the web.xml. That may be stupid, but I'ld like to keep it that way. I don't know if you have any further suggestion to apply to that case. Plus I did not understand the second part of your comment ; where may I remove the dispatcher-servlet loaded by the ContextLoaderListener ?
    – Denis Lebon
    Nov 23 at 9:19












  • In your web.xml both the ContextLoaderListener and DispatcherServlet are loading the same xml. This effectively loads your application twice. Your solution is simply not going to work. The path resolved is always inside the servlet so the part that you use for mapping is ignored. Also do you really want that, this means that for each path you add you need to break open your web.xml which is hardly maintainable. You could configure the RequestMappingHandlerMapping to use the full path to resolve instead of a path inside the DispatcherServlet but I suggest to not go that path.
    – M. Deinum
    Nov 23 at 12:02










  • I'm sorry to be that noobish, but I can't figure out how to solve the ContextLoaderListener problem. Tried to delete it but then application won't work. What do you more precisely mean ? Doc on the subject didn't help me either. For the other part, I'll check with my boss what way should we take. Don't want to modify things I didn't code too hard !
    – Denis Lebon
    Nov 23 at 14:23












  • There is a list of xml files loaded by the ContextLoaderListener, the context-param named contextConfigLocation this list contains the dispatcher-servlet.xml. Which means everything in there gets loaded by both the ContextLoaderLIstner as well as the DispatcherServlet. Hence you are loading all your web related beans twice with no additional benefit.
    – M. Deinum
    Nov 24 at 18:03














  • 1




    You shouldn't map that URL. The URL on the controller is the URL as inside the DispatcherServlet so currently it would be /newsletter/api/newsletter/api/104. In fact you should map your servlet to / instead of all of the partial URLs you have in your controllers. Non related but you are loading your dispatcher-servlet.xml twice, leading to memory pollution. Remove the one that is loaded by the ContextLoaderListener.
    – M. Deinum
    Nov 22 at 18:52












  • I think I see what you mean. But this project is an old one, and the structure is the same for each servlet, as you can see for index and newsletter inside the web.xml. That may be stupid, but I'ld like to keep it that way. I don't know if you have any further suggestion to apply to that case. Plus I did not understand the second part of your comment ; where may I remove the dispatcher-servlet loaded by the ContextLoaderListener ?
    – Denis Lebon
    Nov 23 at 9:19












  • In your web.xml both the ContextLoaderListener and DispatcherServlet are loading the same xml. This effectively loads your application twice. Your solution is simply not going to work. The path resolved is always inside the servlet so the part that you use for mapping is ignored. Also do you really want that, this means that for each path you add you need to break open your web.xml which is hardly maintainable. You could configure the RequestMappingHandlerMapping to use the full path to resolve instead of a path inside the DispatcherServlet but I suggest to not go that path.
    – M. Deinum
    Nov 23 at 12:02










  • I'm sorry to be that noobish, but I can't figure out how to solve the ContextLoaderListener problem. Tried to delete it but then application won't work. What do you more precisely mean ? Doc on the subject didn't help me either. For the other part, I'll check with my boss what way should we take. Don't want to modify things I didn't code too hard !
    – Denis Lebon
    Nov 23 at 14:23












  • There is a list of xml files loaded by the ContextLoaderListener, the context-param named contextConfigLocation this list contains the dispatcher-servlet.xml. Which means everything in there gets loaded by both the ContextLoaderLIstner as well as the DispatcherServlet. Hence you are loading all your web related beans twice with no additional benefit.
    – M. Deinum
    Nov 24 at 18:03








1




1




You shouldn't map that URL. The URL on the controller is the URL as inside the DispatcherServlet so currently it would be /newsletter/api/newsletter/api/104. In fact you should map your servlet to / instead of all of the partial URLs you have in your controllers. Non related but you are loading your dispatcher-servlet.xml twice, leading to memory pollution. Remove the one that is loaded by the ContextLoaderListener.
– M. Deinum
Nov 22 at 18:52






You shouldn't map that URL. The URL on the controller is the URL as inside the DispatcherServlet so currently it would be /newsletter/api/newsletter/api/104. In fact you should map your servlet to / instead of all of the partial URLs you have in your controllers. Non related but you are loading your dispatcher-servlet.xml twice, leading to memory pollution. Remove the one that is loaded by the ContextLoaderListener.
– M. Deinum
Nov 22 at 18:52














I think I see what you mean. But this project is an old one, and the structure is the same for each servlet, as you can see for index and newsletter inside the web.xml. That may be stupid, but I'ld like to keep it that way. I don't know if you have any further suggestion to apply to that case. Plus I did not understand the second part of your comment ; where may I remove the dispatcher-servlet loaded by the ContextLoaderListener ?
– Denis Lebon
Nov 23 at 9:19






I think I see what you mean. But this project is an old one, and the structure is the same for each servlet, as you can see for index and newsletter inside the web.xml. That may be stupid, but I'ld like to keep it that way. I don't know if you have any further suggestion to apply to that case. Plus I did not understand the second part of your comment ; where may I remove the dispatcher-servlet loaded by the ContextLoaderListener ?
– Denis Lebon
Nov 23 at 9:19














In your web.xml both the ContextLoaderListener and DispatcherServlet are loading the same xml. This effectively loads your application twice. Your solution is simply not going to work. The path resolved is always inside the servlet so the part that you use for mapping is ignored. Also do you really want that, this means that for each path you add you need to break open your web.xml which is hardly maintainable. You could configure the RequestMappingHandlerMapping to use the full path to resolve instead of a path inside the DispatcherServlet but I suggest to not go that path.
– M. Deinum
Nov 23 at 12:02




In your web.xml both the ContextLoaderListener and DispatcherServlet are loading the same xml. This effectively loads your application twice. Your solution is simply not going to work. The path resolved is always inside the servlet so the part that you use for mapping is ignored. Also do you really want that, this means that for each path you add you need to break open your web.xml which is hardly maintainable. You could configure the RequestMappingHandlerMapping to use the full path to resolve instead of a path inside the DispatcherServlet but I suggest to not go that path.
– M. Deinum
Nov 23 at 12:02












I'm sorry to be that noobish, but I can't figure out how to solve the ContextLoaderListener problem. Tried to delete it but then application won't work. What do you more precisely mean ? Doc on the subject didn't help me either. For the other part, I'll check with my boss what way should we take. Don't want to modify things I didn't code too hard !
– Denis Lebon
Nov 23 at 14:23






I'm sorry to be that noobish, but I can't figure out how to solve the ContextLoaderListener problem. Tried to delete it but then application won't work. What do you more precisely mean ? Doc on the subject didn't help me either. For the other part, I'll check with my boss what way should we take. Don't want to modify things I didn't code too hard !
– Denis Lebon
Nov 23 at 14:23














There is a list of xml files loaded by the ContextLoaderListener, the context-param named contextConfigLocation this list contains the dispatcher-servlet.xml. Which means everything in there gets loaded by both the ContextLoaderLIstner as well as the DispatcherServlet. Hence you are loading all your web related beans twice with no additional benefit.
– M. Deinum
Nov 24 at 18:03




There is a list of xml files loaded by the ContextLoaderListener, the context-param named contextConfigLocation this list contains the dispatcher-servlet.xml. Which means everything in there gets loaded by both the ContextLoaderLIstner as well as the DispatcherServlet. Hence you are loading all your web related beans twice with no additional benefit.
– M. Deinum
Nov 24 at 18:03

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434394%2fspring-web-xml-not-correctly-including-url-pattern-declarations%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434394%2fspring-web-xml-not-correctly-including-url-pattern-declarations%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

What visual should I use to simply compare current year value vs last year in Power BI desktop

Alexandru Averescu

Trompette piccolo