<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=wgorder" rel="nofollow">William Gorder</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-9206?redirect=false" rel="nofollow">SPR-9206</a></strong> and commented</p>
<p dir="auto">Having to define every annotated class with<br>
&lt;oxm:class-to-be-bound<br>
is tedious.  Would it be possible to add something like the following as part of the framework?</p>
<p dir="auto"><a href="http://springinpractice.com/2011/12/29/its-back-the-classpathscanningjaxb2marshaller/" rel="nofollow">http://springinpractice.com/2011/12/29/its-back-the-classpathscanningjaxb2marshaller/</a><br>
<a href="http://www.walgemoed.org/2010/12/jaxb2-spring-ws/" rel="nofollow">http://www.walgemoed.org/2010/12/jaxb2-spring-ws/</a></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="398116423" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/13626" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/13626/hovercard" href="https://github.com/spring-projects/spring-framework/issues/13626">#13626</a> Add the ability to Scan Packages for JAXB Marshalling (java example provided) (<em><strong>"duplicates"</strong></em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=tomas_johansson" rel="nofollow">Tomas Johansson</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6788?redirect=false" rel="nofollow">SPR-6788</a></strong> and commented</p>
<p dir="auto">For example, if you use these two strings:<br>
"text/html; q=0.7; charset=iso-8859-1"<br>
"text/html; q=0.7"<br>
then the compareTo method will return zero but equals will return false.</p>
<p dir="auto">I suggest that a consistent implementation should either be fixed, or otherwise (if necessary for some reason ?) at least it should be mentioned in the javadoc that the natural ordering that is inconsistent with equals.</p>
<p dir="auto">Example of JUnit test that I think should pass:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="	@Test
	public void verifyConsistentImplementationOf_equals_And_compareTo() {
		verifyConsistentImplementationOf_equals_And_compareTo(
			MediaType.parseMediaType(&quot;text/html; q=0.7; charset=iso-8859-1&quot;),
			MediaType.parseMediaType(&quot;text/html; q=0.7&quot;)
		);
		verifyConsistentImplementationOf_equals_And_compareTo(
				[add more test cases ...]
		);
		[add more test cases ...]
	}

	private void verifyConsistentImplementationOf_equals_And_compareTo(MediaType mediaType1, MediaType mediaType2) {
		assertEquals(mediaType1.equals(mediaType2), mediaType1.compareTo(mediaType2) == 0);
	}"><pre class="notranslate"><code class="notranslate">	@Test
	public void verifyConsistentImplementationOf_equals_And_compareTo() {
		verifyConsistentImplementationOf_equals_And_compareTo(
			MediaType.parseMediaType("text/html; q=0.7; charset=iso-8859-1"),
			MediaType.parseMediaType("text/html; q=0.7")
		);
		verifyConsistentImplementationOf_equals_And_compareTo(
				[add more test cases ...]
		);
		[add more test cases ...]
	}

	private void verifyConsistentImplementationOf_equals_And_compareTo(MediaType mediaType1, MediaType mediaType2) {
		assertEquals(mediaType1.equals(mediaType2), mediaType1.compareTo(mediaType2) == 0);
	}
</code></pre></div>
<p dir="auto">/ Tomas Johansson</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0 GA</p>