<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=gackir" rel="nofollow">Robert Gacki</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-9635?redirect=false" rel="nofollow">SPR-9635</a></strong> and commented</p>
<p dir="auto">Lets say I have an annotated handler method:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@RequestMapping
public @ResponseBody FooResponse doFoo(@RequestBody FooRequest) {
}"><pre class="notranslate"><code class="notranslate">@RequestMapping
public @ResponseBody FooResponse doFoo(@RequestBody FooRequest) {
}
</code></pre></div>
<p dir="auto">And I have HttpMessageConverters that can convert various formats like XML and JSON by looking at the format extension of the MediaType's subtype. In the example, this would be:</p>
<ul dir="auto">
<li><code class="notranslate">application/vnd.foo-request+xml</code> and <code class="notranslate">application/vnd.foo-response+xml</code> for converting from and to XML</li>
<li><code class="notranslate">application/vnd.foo-request+json</code> and <code class="notranslate">application/vnd.foo-response+json</code> for converting from and to XML</li>
</ul>
<p dir="auto">I do not want to pollute my handler methods with the format because the format handling is delegated to the HttpMessageConverters:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@RequestMapping(consumes = &quot;application/vnd.foo-request&quot;, produces = &quot;application/vnd.foo-response&quot;)
public @ResponseBody FooResponse doFoo(@RequestBody FooRequest) {
}"><pre class="notranslate"><code class="notranslate">@RequestMapping(consumes = "application/vnd.foo-request", produces = "application/vnd.foo-response")
public @ResponseBody FooResponse doFoo(@RequestBody FooRequest) {
}
</code></pre></div>
<p dir="auto">The MediaType classes' include method does not allow this scenario. It checks whether the subtype without the suffix is a wildcard and therefore matching: <code class="notranslate">application/*+xml includes application/vnd.foo-response+xml</code>.</p>
<p dir="auto">But it does not check the generalization: <code class="notranslate">application/vnd.foo-response includes application/vnd.foo-response+xml</code> or <code class="notranslate">application/soap includes application/vnd.foo-response+json</code>.</p>
<p dir="auto">So my method, that does not want to know how about the RequestBody's / ResponseBody's serialized format, can not be found by the HandlerMapping (RequestMappingHandlerMapping).</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.1.1</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398109795" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/12560" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/12560/hovercard" href="https://github.com/spring-projects/spring-framework/issues/12560">#12560</a> MappingJacksonHttpMessageConverter default media type should include *+json (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=victorwon" rel="nofollow">Victor</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-843?redirect=false" rel="nofollow">SPR-843</a></strong> and commented</p>
<p dir="auto">In SchedulerFactoryBean class, the following method is intended to create a scheduler using the schedulerName param:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName)
		throws SchedulerException {
	if (schedulerName != null) {
		return schedulerFactory.getScheduler(schedulerName);
	}
	else {
		return schedulerFactory.getScheduler();
	}
}"><pre class="notranslate"><code class="notranslate">protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName)
		throws SchedulerException {
	if (schedulerName != null) {
		return schedulerFactory.getScheduler(schedulerName);
	}
	else {
		return schedulerFactory.getScheduler();
	}
}
</code></pre></div>
<p dir="auto">This, however, doesn't work because the "schedulerFactory.getScheduler(schedulerName)" in quartz is used to retrieve an exisiting instance instead of creating anything new. The result is you always got a NullPointerException if you set the schedulerName in bean config xml.</p>
<p dir="auto">The quick fix is to change it to be as following:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName)
		throws SchedulerException {
	return schedulerFactory.getScheduler();
}"><pre class="notranslate"><code class="notranslate">protected Scheduler createScheduler(SchedulerFactory schedulerFactory, String schedulerName)
		throws SchedulerException {
	return schedulerFactory.getScheduler();
}
</code></pre></div>
<p dir="auto">And specify the schedulerName and quartz instance name in the quartz properties, e.g.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;property name=&quot;schedulerName&quot;&gt;
     &lt;value&gt;cronSched&lt;/value&gt;
&lt;/property&gt;
&lt;property name=&quot;quartzProperties&quot;&gt;
     &lt;props&gt;
          &lt;prop key=&quot;org.quartz.scheduler.instanceName&quot;&gt;cronSched&lt;/prop&gt;
     &lt;/props&gt;
&lt;/property&gt;"><pre class="notranslate"><code class="notranslate">&lt;property name="schedulerName"&gt;
     &lt;value&gt;cronSched&lt;/value&gt;
&lt;/property&gt;
&lt;property name="quartzProperties"&gt;
     &lt;props&gt;
          &lt;prop key="org.quartz.scheduler.instanceName"&gt;cronSched&lt;/prop&gt;
     &lt;/props&gt;
&lt;/property&gt;
</code></pre></div>
<p dir="auto">There must be more elegant solution for this ;)</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 1.1.5</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398055493" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/5499" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/5499/hovercard" href="https://github.com/spring-projects/spring-framework/issues/5499">#5499</a> Multiple schedulers (<em><strong>"duplicates"</strong></em>)</li>
</ul>