language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/aop.xml | @@ -2545,7 +2545,7 @@ public @interface Idempotent {
<itemizedlist>
<listitem>
<para><literal>final</literal> methods cannot be advised, as they
- cannot be overriden.</para>
+ cannot be overridden.</para>
</listitem>
<listitem> | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/beans-classpath-scanning.xml | @@ -144,7 +144,7 @@ public class JpaMovieFinder implements MovieFinder {
<note>
<para>In Spring 3.0 RC1 you can use JSR 330's
<interfacename>@Named</interfacename> annotation in place of
- stereotpye annotations and they will be automatically detected during
+ stereotype annotations and they will be automatically detected during
component-scanning. The value of the
<interfacename>@Named</interfacename> property will be used as the
Bean Name. At this time Spring defaults for bean scope will be applied | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/beans.xml | @@ -224,7 +224,7 @@ The footnote should x-ref to first section in that chapter but I can't find the
<para>After you learn about Spring's IoC container, you may want to know
more about Spring's <interfacename>Resource</interfacename>
abstraction, as described in <xref linkend="resources"/>, which
- provides a convenient mechanism for reading an InputSream from
+ provides a convenient mechanism for reading an InputStream from
locations defined in a URI syntax. In particular,
<classname>Resource</classname> paths are used to construct
applications contexts as described in <xref | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/cache.xml | @@ -98,7 +98,7 @@ public Book findBook(ISBN isbn) {...}]]></programlisting>
In fact, depending on the JVM implementation or running conditions, the same hashCode can be reused for different objects, in the same VM instance.</para>
<para>To provide a different <emphasis>default</emphasis> key generator, one needs to implement the <interfacename>org.springframework.cache.KeyGenerator</interfacename> interface.
- Once configured, the generator will be used for each declaration that doesn not specify its own key generation strategy (see below).
+ Once configured, the generator will be used for each declaration that does not specify its own key generation strategy (see below).
</para>
</section>
@@ -223,11 +223,11 @@ public Book findBook(String name)]]></programlisting>
<section id="cache-annotations-put">
<title><literal>@CachePut</literal> annotation</title>
- <para>For cases where the cache needs to be updated without interferring with the method execution, one can use the <literal>@CachePut</literal> annotation. That is, the method will always
+ <para>For cases where the cache needs to be updated without interfering with the method execution, one can use the <literal>@CachePut</literal> annotation. That is, the method will always
be executed and its result placed into the cache (according to the <literal>@CachePut</literal> options). It supports the same options as <literal>@Cacheable</literal> and should be used
for cache population rather then method flow optimization.</para>
- <para>Note that using <literal>@CachePut</literal> and <literal>@Cacheable</literal> annotations on the same method is generaly discouraged because they have different behaviours. While the latter
+ <para>Note that using <literal>@CachePut</literal> and <literal>@Cacheable</literal> annotations on the same method is generally discouraged because they have different behaviours. While the latter
causes the method execution to be skipped by using the cache, the former forces the execution in order to execute a cache update. This leads to unexpected behaviour and with the exception of specific
corner-cases (such as annotations having conditions that exclude them from each other), such declarations should be avoided.</para>
</section>
@@ -447,7 +447,7 @@ public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)]]><
public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)]]></programlisting>
<para>Even though <literal>@SlowService</literal> is not a Spring annotation, the container automatically picks up its declaration at runtime and understands its meaning. Note that as
- mentined <link linkend="cache-annotation-enable">above</link>, the annotation-driven behaviour needs to be enabled.</para>
+ mentioned <link linkend="cache-annotation-enable">above</link>, the annotation-driven behaviour needs to be enabled.</para>
</section>
</section>
@@ -488,7 +488,7 @@ public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)]]><
<para>The declarative XML caching supports all of the annotation-based model so moving between the two should be fairly easy - further more both can be used inside the same application.
The XML based approach does not touch the target code however it is inherently more verbose; when dealing with classes with overloaded methods that are targeted for caching, identifying the
proper methods does take an extra effort since the <literal>method</literal> argument is not a good discriminator - in these cases, the AspectJ pointcut can be used to cherry pick the target
- methods and apply the appropriate caching functionality. Howeve through XML, it is easier to apply a package/group/interface-wide caching (again due to the AspectJ poincut) and to create
+ methods and apply the appropriate caching functionality. However through XML, it is easier to apply a package/group/interface-wide caching (again due to the AspectJ pointcut) and to create
template-like definitions (as we did in the example above by defining the target cache through the <literal>cache:definitions </literal><literal>cache</literal> attribute).
</para>
</section>
@@ -554,7 +554,7 @@ public Book findBook(ISBN isbn, boolean checkWarehouse, boolean includeUsed)]]><
<property name="addNoOpCache" value="true"/>
</bean>]]></programlisting>
- <para>The <literal>CompositeCacheManager</literal> above chains multiple <literal>CacheManager</literal>s and aditionally, through the <literal>addNoOpManager</literal> flag, adds a
+ <para>The <literal>CompositeCacheManager</literal> above chains multiple <literal>CacheManager</literal>s and additionally, through the <literal>addNoOpManager</literal> flag, adds a
<emphasis>no op</emphasis> cache that for all the definitions not handled by the configured cache managers. That is, every cache definition not found in either <literal>jdkCache</literal>
or <literal>gemfireCache</literal> (configured above) will be handled by the no op cache, which will not store any information causing the target method to be executed every time.
</para> | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/classic-aop-spring.xml | @@ -1808,7 +1808,7 @@ Object oldTarget = swapper.swap(newTarget);</programlisting></para>
<para>Note that the target object - "businessObjectTarget" in the
example - <emphasis>must</emphasis> be a prototype. This allows the
<literal>PoolingTargetSource</literal> implementation to create new
- instances of the target to grow the pool as necessary. See the havadoc
+ instances of the target to grow the pool as necessary. See the Javadoc
for <literal>AbstractPoolingTargetSource</literal> and the concrete
subclass you wish to use for information about its properties: "maxSize"
is the most basic, and always guaranteed to be present.</para> | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/expressions.xml | @@ -688,7 +688,7 @@ boolean trueValue = parser.parseExpression(expression).getValue(societyContext,
boolean trueValue = parser.parseExpression("true or false").getValue(Boolean.class);
// evaluates to true
-String expression = "isMember('Nikola Tesla') or isMember('Albert Einstien')";
+String expression = "isMember('Nikola Tesla') or isMember('Albert Einstein')";
boolean trueValue = parser.parseExpression(expression).getValue(societyContext, Boolean.class);
// -- NOT -- | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/jdbc.xml | @@ -736,7 +736,7 @@ public Actor findActor(String specialty, int age) {
};
- <lineannotation>// notice the wrapping up of the argumenta in an array</lineannotation>
+ <lineannotation>// notice the wrapping up of the arguments in an array</lineannotation>
return (Actor) jdbcTemplate.queryForObject(sql, new Object[] {specialty, age}, mapper);
}</programlisting>
@@ -813,7 +813,7 @@ public Actor findActor(String specialty, int age) {
class="libraryfile">sql-error-codes.xml</filename>. This file is
populated with vendor codes and based on the
<code>DatabaseProductName</code> taken from the
- <interfacename>DatabaseMetaData</interfacename>. The codes for the acual
+ <interfacename>DatabaseMetaData</interfacename>. The codes for the actual
database you are using are used.<!--what do you mean by *the current* database? --><!--TR: Revised, please review.--></para>
<para>The <classname>SQLErrorCodeSQLExceptionTranslator</classname>
@@ -888,7 +888,7 @@ public Actor findActor(String specialty, int age) {
processing where this translator is needed. Here is an example of how
this custom translator can be used:</para>
- <programlisting language="java"><lineannotation>private JdbcTemplate jdbcTemoplate;
+ <programlisting language="java"><lineannotation>private JdbcTemplate jdbcTemplate;
public void setDataSource(DataSource dataSource) {
// create a <classname>JdbcTemplate</classname> and set data source</lineannotation>
@@ -901,7 +901,7 @@ public void setDataSource(DataSource dataSource) {
}
<lineannotation>public void updateShippingCharge(long orderId, long pct) {
- // use the <classname>prepared JdbcTemplate</classname> for this u<classname>pdate</classname></lineannotation>
+ // use the <classname>prepared JdbcTemplate</classname> for this <classname>update</classname></lineannotation>
this.jdbcTemplate.update(
"update orders" +
" set shipping_charge = shipping_charge * ? / 100" +
@@ -1547,8 +1547,8 @@ dataSource.setPassword("");</programlisting>
length indicates the number of updates in that batch. The number of
updates in each batch should be the the batch size provided for all
batches except for the last one that might be less, depending on the
- total number of updat objects provided. The update count for each update
- stament is the one reported by the JDBC driver. If the count is not
+ total number of update objects provided. The update count for each update
+ statement is the one reported by the JDBC driver. If the count is not
available, the JDBC driver returns a -2 value.</para>
</section>
</section>
@@ -2501,7 +2501,7 @@ public class TitlesAfterDateStoredProcedure extends StoredProcedure {
<para>Many update and query methods of the
<classname>JdbcTemplate</classname> take an additional parameter in
the form of an <code>int </code>array. This array is used to
- indicate the SQL type of the coresponding parameter using constant
+ indicate the SQL type of the corresponding parameter using constant
values from the <classname>java.sql.Types</classname> class. <!--Reword to say *what* is using constant values from the java.sql.Types class to do *what*. Phrases that being with *using* are --><!--often unclear as to what uses what to do what.-->Provide
one entry for each parameter.</para>
</listitem>
@@ -2983,7 +2983,7 @@ public class DataAccessUnitTestTemplate {
<jdbc:script location="..."/>
</jdbc:initialize-database></programlisting>In this example we are
saying we expect that sometimes the scripts will be run against an empty
- dtabase and there are some DROP statements in the scripts which would
+ database and there are some DROP statements in the scripts which would
therefore fail. So failed SQL <code>DROP</code> statements will be
ignored, but other failures will cause an exception. This is useful if
your SQL dialect doesn't support <code>DROP ... IF EXISTS</code> (or | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/mvc.xml | @@ -269,7 +269,7 @@
</web-app></programlisting>
- <para>In the preceding example, all requests startig with
+ <para>In the preceding example, all requests starting with
<literal>/example</literal> will be handled by the
<classname>DispatcherServlet</classname> instance named
<literal>example</literal>. This is only the first step in setting up
@@ -1073,7 +1073,7 @@ public void addPet(@RequestBody Pet pet, Model model) {
<para>The <emphasis>consumes</emphasis> condition is supported on
the type and on the method level. Unlike most other conditions, when
used at the type level, method-level consumable types override
- rather than extend type-level consumeable types.</para>
+ rather than extend type-level consumable types.</para>
</tip>
</section>
@@ -1116,7 +1116,7 @@ public Pet getPet(@PathVariable String petId, Model model) {
<para>You can narrow request matching through request parameter
conditions such as <code>"myParam"</code>, <code>"!myParam"</code>, or
<code>"myParam=myValue"</code>. The first two test for request
- parameter presense/absence and the third for a specific parameter
+ parameter presence/absence and the third for a specific parameter
value. Here is an example with a request parameter value
condition:</para>
@@ -4581,7 +4581,7 @@ public class WebConfig extends WebMvcConfigurerAdapter {
<code>DefaultServletHttpRequestHandler</code> will attempt to
auto-detect the default Servlet for the container at startup time, using
a list of known names for most of the major Servlet containers
- (including Tomcat, Jetty, Glassfish, JBoss, Resin, WebLogic, and
+ (including Tomcat, Jetty, GlassFish, JBoss, Resin, WebLogic, and
WebSphere). If the default Servlet has been custom configured with a
different name, or if a different Servlet container is being used where
the default Servlet name is unknown, then the default Servlet's name | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/new-in-3.1.xml | @@ -490,7 +490,7 @@
<para>A new <classname>UriComponents</classname> class has been added,
which is an immutable container of URI components providing
access to all contained URI components.
- A nenw <classname>UriComponentsBuilder</classname> class is also
+ A new <classname>UriComponentsBuilder</classname> class is also
provided to help create <classname>UriComponents</classname> instances.
Together the two classes give fine-grained control over all
aspects of preparing a URI including construction, expansion | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/overview.xml | @@ -427,7 +427,7 @@ TR: OK. Added to diagram.--></para>
development snapshots and milestone releases (a copy of the final
releases is also held here). The jar file names are in the same
form as Maven Central, so this is a useful place to get
- development versions of Spring to use with other libraries depoyed
+ development versions of Spring to use with other libraries deployed
in Maven Central.</para>
</listitem>
</itemizedlist></para>
@@ -615,7 +615,7 @@ TR: OK. Added to diagram.--></para>
<para>We used the Maven Central naming conventions in the example
above, so that works with Maven Central or the SpringSource S3 Maven
repository. To use the S3 Maven repository (e.g. for milestones or
- developer snaphots), you need to specify the repository location in
+ developer snapshots), you need to specify the repository location in
your Maven configuration. For full releases:</para>
<programlisting><repositories>
@@ -670,7 +670,7 @@ TR: OK. Added to diagram.--></para>
</repositories></programlisting>
<para>If you are managing your dependencies by hand, the URL in the
- repository declaration above is not browseable, but there is a user
+ repository declaration above is not browsable, but there is a user
interface at <ulink
url="http://www.springsource.com/repository">http://www.springsource.com/repository</ulink>
that can be used to search for and download dependencies. It also has
@@ -879,8 +879,8 @@ TR: OK. Added to diagram.--></para>
and generates fewer dependencies, is to bind directly to <ulink type=""
url="http://logback.qos.ch">Logback</ulink>. This removes the extra
binding step because Logback implements SLF4J directly, so you only need
- to depend on two libaries not four (<code>jcl-over-slf4j</code> and
- <code>logback</code>). If you do that you might also need to exlude the
+ to depend on two libraries not four (<code>jcl-over-slf4j</code> and
+ <code>logback</code>). If you do that you might also need to exclude the
slf4j-api dependency from other external dependencies (not Spring),
because you only want one version of that API on the classpath.</para>
| true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/portlet.xml | @@ -518,7 +518,7 @@
included here for completeness.</para>
<para>When using the <classname>AbstractController</classname> as a
- baseclass for your controllers (which is not recommended since there
+ base class for your controllers (which is not recommended since there
are a lot of other controllers that might already do the job for
you) you only have to override either the
<methodname>handleActionRequestInternal(ActionRequest, | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/remoting.xml | @@ -1473,7 +1473,7 @@ URI location = template.postForLocation(uri, booking, "1");
URI uri = uriComponents.toUri();</programlisting>
- <para>Or specify each URI component indiviudally:</para>
+ <para>Or specify each URI component individually:</para>
<programlisting language="java">UriComponents uriComponents =
UriComponentsBuilder.newInstance() | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/resources.xml | @@ -651,7 +651,7 @@
case, the resolution strategy is fairly simple: a
ClassLoader.getResources() call is used on the last non-wildcard path
segment to get all the matching resources in the class loader
- hierarchy, and then off each resource the same PathMatcher resoltion
+ hierarchy, and then off each resource the same PathMatcher resolution
strategy described above is used for the wildcard subpath.</para>
</section>
| true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/scheduling.xml | @@ -592,7 +592,7 @@ Future<String> returnSomething(int i) {
<para><interfacename>@Async</interfacename> can not be used in
conjunction with lifecycle callbacks such as
- <interfacename>@PostConstruct</interfacename>. To asynchonously
+ <interfacename>@PostConstruct</interfacename>. To asynchronously
initialize Spring beans you currently have to use a separate
initializing Spring bean that invokes the
<interfacename>@Async</interfacename> annotated method on the target | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/validation.xml | @@ -1085,7 +1085,7 @@ public interface ConversionService {
</programlisting>
<para> A default ConversionService can convert between strings, numbers,
- enums, collections, maps, and other common types. To suppliment or
+ enums, collections, maps, and other common types. To supplement or
override the default converters with your own custom converter(s), set
the <code>converters</code> property. Property values may implement
either of the Converter, ConverterFactory, or GenericConverter
@@ -1112,9 +1112,9 @@ public interface ConversionService {
</section>
<section id="core-convert-programmatic-usage">
- <title>Using a ConversionService programatically</title>
+ <title>Using a ConversionService programmatically</title>
- <para> To work with a ConversionService instance programatically, simply
+ <para> To work with a ConversionService instance programmatically, simply
inject a reference to it like you would for any other bean: </para>
<programlisting language="java"><![CDATA[@Service
@@ -1353,10 +1353,10 @@ public interface AnnotationFormatterFactory<A extends Annotation> {
<para> The FormatterRegistry is an SPI for registering formatters and
converters. <classname>FormattingConversionService</classname> is
an implementation of FormatterRegistry suitable for most environments.
- This implementation may be configured programatically or declaratively
+ This implementation may be configured programmatically or declaratively
as a Spring bean using
<classname>FormattingConversionServiceFactoryBean</classname>.
- Because this implemementation also implements
+ Because this implementation also implements
<classname>ConversionService</classname>, it can be directly
configured for use with Spring's DataBinder and the Spring Expression
Language (SpEL).
@@ -1419,7 +1419,7 @@ public interface FormatterRegistrar {
<title>Configuring Formatting in Spring MVC</title>
<para> In a Spring MVC application, you may configure a custom
- ConversionService instance explicity as an attribute of the
+ ConversionService instance explicitly as an attribute of the
<literal>annotation-driven</literal> element of the MVC namespace. This
ConversionService will then be used anytime a type conversion is
required during Controller model binding. If not configured explicitly,
@@ -1443,7 +1443,7 @@ public interface FormatterRegistrar {
</beans>]]></programlisting>
- <para> With this one-line of configuation, default formatters for Numbers
+ <para> With this one-line of configuration, default formatters for Numbers
and Date types will be installed, including support for the
@NumberFormat and @DateTimeFormat annotations. Full support for the Joda
Time formatting library is also installed if Joda Time is present on the
@@ -1503,7 +1503,7 @@ public interface FormatterRegistrar {
<para> Spring 3 introduces several enhancements to its validation support.
First, the JSR-303 Bean Validation API is now fully supported. Second,
- when used programatically, Spring's DataBinder can now validate objects as
+ when used programmatically, Spring's DataBinder can now validate objects as
well as bind to them. Third, Spring MVC now has support for declaratively
validating @Controller inputs. </para>
@@ -1671,7 +1671,7 @@ public class MyConstraintValidator implements ConstraintValidator {
<code>binder.validate()</code>. Any validation Errors are automatically
added to the binder's BindingResult. </para>
- <para> When working with the DataBinder programatically, this can be used
+ <para> When working with the DataBinder programmatically, this can be used
to invoke validation logic after binding to a target object: </para>
<programlisting language="java">Foo target = new Foo(); | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/web-integration.xml | @@ -624,7 +624,7 @@
<para>
<quote>
- <emphasis>A very succesful design pattern in Tapestry is to keep pages
+ <emphasis>A very successful design pattern in Tapestry is to keep pages
and components very simple, and <emphasis
role="bold">delegate</emphasis> as much logic as possible out to
HiveMind [or Spring, or whatever] services. Listener methods should | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/xml-custom.xml | @@ -225,7 +225,7 @@ public class SimpleDateFormatBeanDefinitionParser extends AbstractSingleBeanDefi
properties files. These properties files are both placed in a
<filename class="directory">'META-INF'</filename> directory in your application, and can, for
example, be distributed alongside your binary classes in a JAR file. The Spring XML parsing
- infrastructurewill automatically pick up your new extension by consuming these special
+ infrastructure will automatically pick up your new extension by consuming these special
properties files, the formats of which are detailed below.</para>
<section id="extensible-xml-registration-spring-handlers">
<title><filename>'META-INF/spring.handlers'</filename></title> | true |
Other | spring-projects | spring-framework | f1c062fe9e2b959981a9bd993dd0e05ea590a82a.json | Fix typos in Reference Documentation | src/reference/docbook/xsd-configuration.xml | @@ -125,7 +125,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem
implementation, the <classname>FieldRetrievingFactoryBean</classname>, to
set the value of the <literal>'isolation'</literal> property on a bean
to the value of the <literal>'java.sql.Connection.TRANSACTION_SERIALIZABLE'</literal>
- constant. This is all well and good, but it is a tad verbose and (unneccessarily)
+ constant. This is all well and good, but it is a tad verbose and (unnecessarily)
exposes Spring's internal plumbing to the end user.
</para>
<para>The following XML Schema-based version is more concise
@@ -771,7 +771,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schem
<interfacename>@Resource</interfacename> (if available), and JPA's
<interfacename>@PersistenceContext</interfacename> and <interfacename>@PersistenceUnit</interfacename>
(if available). Alternatively, you can choose to activate the individual
- <interfacename>BeanPostProcessors</interfacename> for those annotations explictly.</para>
+ <interfacename>BeanPostProcessors</interfacename> for those annotations explicitly.</para>
<note>
<para>This element does <emphasis>not</emphasis> activate processing of Spring's
<link linkend="transaction-declarative-annotations"><interfacename>@Transactional</interfacename></link> | true |
Other | spring-projects | spring-framework | c57d4e238629249e0d9be2853b9bfba582939aa3.json | Add trySet method to DeferredResult
The method absorbs any potential StaleAsyncWebRequestException and
returns false instead.
Issue: SPR-8517 | spring-web/src/main/java/org/springframework/web/context/request/async/DeferredResult.java | @@ -103,6 +103,22 @@ public void set(Object result) throws StaleAsyncWebRequestException {
}
}
+ /**
+ * A variant of {@link #set(Object)} that absorbs a potential, resulting
+ * {@link StaleAsyncWebRequestException}.
+ * @return {@code false} if the outcome was a {@code StaleAsyncWebRequestException}
+ */
+ public boolean trySet(Object result) throws StaleAsyncWebRequestException {
+ try {
+ set(result);
+ return true;
+ }
+ catch (StaleAsyncWebRequestException ex) {
+ // absorb
+ }
+ return false;
+ }
+
/**
* Invoked to complete async processing when a timeout occurs before
* {@link #set(Object)} is called. Or if {@link #set(Object)} is already in | true |
Other | spring-projects | spring-framework | c57d4e238629249e0d9be2853b9bfba582939aa3.json | Add trySet method to DeferredResult
The method absorbs any potential StaleAsyncWebRequestException and
returns false instead.
Issue: SPR-8517 | spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java | @@ -388,10 +388,11 @@ public void setIgnoreDefaultModelOnRedirect(boolean ignoreDefaultModelOnRedirect
}
/**
- * Set an AsyncTaskExecutor to use when a controller method returns a Callable.
- * <p>The default is a {@link SimpleAsyncTaskExecutor}
- *
- * TODO... need a better default
+ * Set the AsyncTaskExecutor to use when a controller method returns a
+ * {@code Callable}.
+ * <p>The default instance type is a {@link SimpleAsyncTaskExecutor}.
+ * It's recommended to change that default in production as the simple
+ * executor does not re-use threads.
*/
public void setAsyncTaskExecutor(AsyncTaskExecutor taskExecutor) {
this.taskExecutor = taskExecutor; | true |
Other | spring-projects | spring-framework | 816c1f47a4a9638d9442b5060312a6b2082eb7b1.json | Translate EOF to HttpMessageNotReadableException
The MappingJacksonHttpMessageConverter now catches all IOException
types raised while reading JSON and translates them into
HttpMessageNotReadableException.
Issue: SPR-9238 | spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java | @@ -148,7 +148,7 @@ protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage)
try {
return this.objectMapper.readValue(inputMessage.getBody(), javaType);
}
- catch (JsonProcessingException ex) {
+ catch (IOException ex) {
throw new HttpMessageNotReadableException("Could not read JSON: " + ex.getMessage(), ex);
}
} | true |
Other | spring-projects | spring-framework | 816c1f47a4a9638d9442b5060312a6b2082eb7b1.json | Translate EOF to HttpMessageNotReadableException
The MappingJacksonHttpMessageConverter now catches all IOException
types raised while reading JSON and translates them into
HttpMessageNotReadableException.
Issue: SPR-9238 | spring-web/src/main/java/org/springframework/http/converter/json/MappingJacksonHttpMessageConverter.java | @@ -148,7 +148,7 @@ protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage)
try {
return this.objectMapper.readValue(inputMessage.getBody(), javaType);
}
- catch (JsonProcessingException ex) {
+ catch (IOException ex) {
throw new HttpMessageNotReadableException("Could not read JSON: " + ex.getMessage(), ex);
}
} | true |
Other | spring-projects | spring-framework | 816c1f47a4a9638d9442b5060312a6b2082eb7b1.json | Translate EOF to HttpMessageNotReadableException
The MappingJacksonHttpMessageConverter now catches all IOException
types raised while reading JSON and translates them into
HttpMessageNotReadableException.
Issue: SPR-9238 | src/dist/changelog.txt | @@ -17,6 +17,7 @@ Changes in version 3.2 M1
* add pretty print option to Jackson HttpMessageConverter and View types
* fix issue with resolving Errors controller method argument
* detect controller methods via InitializingBean in RequestMappingHandlerMapping
+* translate IOException from Jackson to HttpMessageNotReadableException
Changes in version 3.1.1 (2012-02-16)
------------------------------------- | true |
Other | spring-projects | spring-framework | f61f4a960e1b28e96abe8912a137720fcd0690f5.json | Discover controllers based on type @RequestMapping
This was supported in DefaultAnnotationHandlerMapping but not in the
RequestMappingHandlerMapping. The specific scenario where this matters
is a controller decorated with a JDK proxy. In this scenario the
HandlerMapping looks at interfaces only to decide if the bean is a
controller. The @Controller annotation is better left (and required)
on the class.
Issue: SPR-9374 | spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.java | @@ -45,7 +45,7 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
private boolean useSuffixPatternMatch = true;
private boolean useTrailingSlashMatch = true;
-
+
/**
* Whether to use suffix pattern match (".*") when matching patterns to
* requests. If enabled a method mapped to "/users" also matches to "/users.*".
@@ -54,7 +54,7 @@ public class RequestMappingHandlerMapping extends RequestMappingInfoHandlerMappi
public void setUseSuffixPatternMatch(boolean useSuffixPatternMatch) {
this.useSuffixPatternMatch = useSuffixPatternMatch;
}
-
+
/**
* Whether to match to URLs irrespective of the presence of a trailing slash.
* If enabled a method mapped to "/users" also matches to "/users/".
@@ -83,7 +83,8 @@ public boolean useTrailingSlashMatch() {
*/
@Override
protected boolean isHandler(Class<?> beanType) {
- return AnnotationUtils.findAnnotation(beanType, Controller.class) != null;
+ return ((AnnotationUtils.findAnnotation(beanType, Controller.class) != null) ||
+ (AnnotationUtils.findAnnotation(beanType, RequestMapping.class) != null));
}
/**
@@ -123,7 +124,7 @@ protected RequestMappingInfo getMappingForMethod(Method method, Class<?> handler
protected RequestCondition<?> getCustomMethodCondition(Method method) {
return null;
}
-
+
/**
* Provide a custom type-level request condition.
* The custom {@link RequestCondition} can be of any type so long as the | true |
Other | spring-projects | spring-framework | f61f4a960e1b28e96abe8912a137720fcd0690f5.json | Discover controllers based on type @RequestMapping
This was supported in DefaultAnnotationHandlerMapping but not in the
RequestMappingHandlerMapping. The specific scenario where this matters
is a controller decorated with a JDK proxy. In this scenario the
HandlerMapping looks at interfaces only to decide if the bean is a
controller. The @Controller annotation is better left (and required)
on the class.
Issue: SPR-9374 | spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HandlerMethodAnnotationDetectionTests.java | @@ -51,37 +51,37 @@
import org.springframework.web.servlet.ModelAndView;
/**
- * Test various scenarios for detecting method-level and method parameter annotations depending
- * on where they are located -- on interfaces, parent classes, in parameterized methods, or in
+ * Test various scenarios for detecting method-level and method parameter annotations depending
+ * on where they are located -- on interfaces, parent classes, in parameterized methods, or in
* combination with proxies.
- *
+ *
* @author Rossen Stoyanchev
*/
@RunWith(Parameterized.class)
public class HandlerMethodAnnotationDetectionTests {
-
+
@Parameters
public static Collection<Object[]> handlerTypes() {
Object[][] array = new Object[12][2];
array[0] = new Object[] { SimpleController.class, true}; // CGLib proxy
array[1] = new Object[] { SimpleController.class, false};
-
+
array[2] = new Object[] { AbstractClassController.class, true }; // CGLib proxy
array[3] = new Object[] { AbstractClassController.class, false };
-
- array[4] = new Object[] { ParameterizedAbstractClassController.class, false}; // CGLib proxy
- array[5] = new Object[] { ParameterizedAbstractClassController.class, false};
-
+
+ array[4] = new Object[] { ParameterizedAbstractClassController.class, false}; // CGLib proxy
+ array[5] = new Object[] { ParameterizedAbstractClassController.class, false};
+
array[6] = new Object[] { InterfaceController.class, true }; // JDK dynamic proxy
- array[7] = new Object[] { InterfaceController.class, false };
-
- array[8] = new Object[] { ParameterizedInterfaceController.class, false}; // no AOP
- array[9] = new Object[] { ParameterizedInterfaceController.class, false};
-
+ array[7] = new Object[] { InterfaceController.class, false };
+
+ array[8] = new Object[] { ParameterizedInterfaceController.class, false}; // no AOP
+ array[9] = new Object[] { ParameterizedInterfaceController.class, false};
+
array[10] = new Object[] { SupportClassController.class, true}; // CGLib proxy
array[11] = new Object[] { SupportClassController.class, false};
-
+
return Arrays.asList(array);
}
@@ -101,7 +101,7 @@ public HandlerMethodAnnotationDetectionTests(Class<?> controllerType, boolean us
context.getBeanFactory().registerSingleton("advisor", new DefaultPointcutAdvisor(new SimpleTraceInterceptor()));
}
context.refresh();
-
+
handlerMapping.setApplicationContext(context);
handlerAdapter.afterPropertiesSet();
exceptionResolver.afterPropertiesSet();
@@ -113,12 +113,12 @@ public void testRequestMappingMethod() throws Exception {
SimpleDateFormat dateFormat = new SimpleDateFormat(datePattern);
String dateA = "11:01:2011";
String dateB = "11:02:2011";
-
+
MockHttpServletRequest request = new MockHttpServletRequest("POST", "/path1/path2");
request.setParameter("datePattern", datePattern);
request.addHeader("header1", dateA);
request.addHeader("header2", dateB);
-
+
HandlerExecutionChain chain = handlerMapping.getHandler(request);
assertNotNull(chain);
@@ -133,7 +133,7 @@ public void testRequestMappingMethod() throws Exception {
assertEquals("failure", response.getContentAsString());
}
-
+
/**
* SIMPLE CASE
*/
@@ -156,15 +156,15 @@ public void initModel(@RequestHeader("header1") Date date, Model model) {
public Date handle(@RequestHeader("header2") Date date) throws Exception {
return date;
}
-
+
@ExceptionHandler(Exception.class)
@ResponseBody
public String handleException(Exception exception) {
return exception.getMessage();
}
- }
+ }
+
-
@Controller
static abstract class MappingAbstractClass {
@@ -177,15 +177,15 @@ static abstract class MappingAbstractClass {
@RequestMapping(value="/path1/path2", method=RequestMethod.POST)
@ModelAttribute("attr2")
public abstract Date handle(Date date, Model model) throws Exception;
-
+
@ExceptionHandler(Exception.class)
@ResponseBody
public abstract String handleException(Exception exception);
- }
+ }
/**
* CONTROLLER WITH ABSTRACT CLASS
- *
+ *
* <p>All annotations can be on methods in the abstract class except parameter annotations.
*/
static class AbstractClassController extends MappingAbstractClass {
@@ -202,14 +202,15 @@ public void initModel(@RequestHeader("header1") Date date, Model model) {
public Date handle(@RequestHeader("header2") Date date, Model model) throws Exception {
return date;
}
-
+
public String handleException(Exception exception) {
return exception.getMessage();
}
}
-
-
- @Controller
+
+ // SPR-9374
+
+ @RequestMapping
static interface MappingInterface {
@InitBinder
@@ -221,15 +222,15 @@ static interface MappingInterface {
@RequestMapping(value="/path1/path2", method=RequestMethod.POST)
@ModelAttribute("attr2")
Date handle(@RequestHeader("header2") Date date, Model model) throws Exception;
-
+
@ExceptionHandler(Exception.class)
@ResponseBody
String handleException(Exception exception);
- }
+ }
/**
* CONTROLLER WITH INTERFACE
- *
+ *
* No AOP:
* All annotations can be on interface methods except parameter annotations.
*
@@ -250,7 +251,7 @@ public void initModel(@RequestHeader("header1") Date date, Model model) {
public Date handle(@RequestHeader("header2") Date date, Model model) throws Exception {
return date;
}
-
+
public String handleException(Exception exception) {
return exception.getMessage();
}
@@ -269,15 +270,15 @@ public String handleException(Exception exception) {
@RequestMapping(value="/path1/path2", method=RequestMethod.POST)
@ModelAttribute("attr2")
public abstract Date handle(C date, Model model) throws Exception;
-
+
@ExceptionHandler(Exception.class)
@ResponseBody
public abstract String handleException(Exception exception);
- }
+ }
/**
* CONTROLLER WITH PARAMETERIZED BASE CLASS
- *
+ *
* <p>All annotations can be on methods in the abstract class except parameter annotations.
*/
static class ParameterizedAbstractClassController extends MappingParameterizedAbstractClass<String, Date, Date> {
@@ -294,14 +295,13 @@ public void initModel(@RequestHeader("header1") Date date, Model model) {
public Date handle(@RequestHeader("header2") Date date, Model model) throws Exception {
return date;
}
-
+
public String handleException(Exception exception) {
return exception.getMessage();
}
}
-
- @Controller
+ @RequestMapping
static interface MappingParameterizedInterface<A, B, C> {
@InitBinder
@@ -313,17 +313,17 @@ public String handleException(Exception exception) {
@RequestMapping(value="/path1/path2", method=RequestMethod.POST)
@ModelAttribute("attr2")
Date handle(C date, Model model) throws Exception;
-
+
@ExceptionHandler(Exception.class)
@ResponseBody
String handleException(Exception exception);
- }
+ }
/**
* CONTROLLER WITH PARAMETERIZED INTERFACE
- *
+ *
* <p>All annotations can be on interface except parameter annotations.
- *
+ *
* <p>Cannot be used as JDK dynamic proxy since parameterized interface does not contain type information.
*/
static class ParameterizedInterfaceController implements MappingParameterizedInterface<String, Date, Date> {
@@ -344,18 +344,18 @@ public void initModel(@RequestHeader("header1") Date date, Model model) {
public Date handle(@RequestHeader("header2") Date date, Model model) throws Exception {
return date;
}
-
+
@ExceptionHandler(Exception.class)
@ResponseBody
public String handleException(Exception exception) {
return exception.getMessage();
}
- }
-
-
+ }
+
+
/**
* SPR-8248
- *
+ *
* <p>Support class contains all annotations. Subclass has type-level @{@link RequestMapping}.
*/
@Controller
@@ -377,17 +377,17 @@ public void initModel(@RequestHeader("header1") Date date, Model model) {
public Date handle(@RequestHeader("header2") Date date, Model model) throws Exception {
return date;
}
-
+
@ExceptionHandler(Exception.class)
@ResponseBody
public String handleException(Exception exception) {
return exception.getMessage();
}
- }
+ }
@Controller
@RequestMapping("/path1")
static class SupportClassController extends MappingSupportClass {
- }
+ }
} | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | build.gradle | @@ -327,6 +327,7 @@ project('spring-web') {
compile("commons-httpclient:commons-httpclient:3.1", optional)
compile("org.apache.httpcomponents:httpclient:4.1.1", optional)
compile("org.codehaus.jackson:jackson-mapper-asl:1.4.2", optional)
+ compile("com.fasterxml.jackson.core:jackson-databind:2.0.1", optional)
compile("taglibs:standard:1.1.2", optional)
compile("org.mortbay.jetty:jetty:6.1.9") { dep ->
optional dep | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | spring-web/src/main/java/org/springframework/http/converter/json/MappingJackson2HttpMessageConverter.java | @@ -0,0 +1,188 @@
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.http.converter.json;
+
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.List;
+
+import org.springframework.http.HttpInputMessage;
+import org.springframework.http.HttpOutputMessage;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.AbstractHttpMessageConverter;
+import org.springframework.http.converter.HttpMessageNotReadableException;
+import org.springframework.http.converter.HttpMessageNotWritableException;
+import org.springframework.util.Assert;
+
+import com.fasterxml.jackson.core.JsonEncoding;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * Implementation of {@link org.springframework.http.converter.HttpMessageConverter HttpMessageConverter}
+ * that can read and write JSON using <a href="http://jackson.codehaus.org/">Jackson 2's</a> {@link ObjectMapper}.
+ *
+ * <p>This converter can be used to bind to typed beans, or untyped {@link java.util.HashMap HashMap} instances.
+ *
+ * <p>By default, this converter supports {@code application/json}. This can be overridden by setting the
+ * {@link #setSupportedMediaTypes(List) supportedMediaTypes} property.
+ *
+ * @author Arjen Poutsma
+ * @author Keith Donald
+ * @since 3.2
+ * @see org.springframework.web.servlet.view.json.MappingJackson2JsonView
+ */
+public class MappingJackson2HttpMessageConverter extends AbstractHttpMessageConverter<Object> {
+
+ public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
+
+
+ private ObjectMapper objectMapper = new ObjectMapper();
+
+ private boolean prefixJson = false;
+
+
+ /**
+ * Construct a new {@code BindingJacksonHttpMessageConverter}.
+ */
+ public MappingJackson2HttpMessageConverter() {
+ super(new MediaType("application", "json", DEFAULT_CHARSET));
+ }
+
+ /**
+ * Set the {@code ObjectMapper} for this view. If not set, a default
+ * {@link ObjectMapper#ObjectMapper() ObjectMapper} is used.
+ * <p>Setting a custom-configured {@code ObjectMapper} is one way to take further control of the JSON
+ * serialization process. For example, an extended {@link org.codehaus.jackson.map.SerializerFactory}
+ * can be configured that provides custom serializers for specific types. The other option for refining
+ * the serialization process is to use Jackson's provided annotations on the types to be serialized,
+ * in which case a custom-configured ObjectMapper is unnecessary.
+ */
+ public void setObjectMapper(ObjectMapper objectMapper) {
+ Assert.notNull(objectMapper, "ObjectMapper must not be null");
+ this.objectMapper = objectMapper;
+ }
+
+ /**
+ * Return the underlying {@code ObjectMapper} for this view.
+ */
+ public ObjectMapper getObjectMapper() {
+ return this.objectMapper;
+ }
+
+ /**
+ * Indicate whether the JSON output by this view should be prefixed with "{} &&". Default is false.
+ * <p>Prefixing the JSON string in this manner is used to help prevent JSON Hijacking.
+ * The prefix renders the string syntactically invalid as a script so that it cannot be hijacked.
+ * This prefix does not affect the evaluation of JSON, but if JSON validation is performed on the
+ * string, the prefix would need to be ignored.
+ */
+ public void setPrefixJson(boolean prefixJson) {
+ this.prefixJson = prefixJson;
+ }
+
+
+ @Override
+ public boolean canRead(Class<?> clazz, MediaType mediaType) {
+ JavaType javaType = getJavaType(clazz);
+ return (this.objectMapper.canDeserialize(javaType) && canRead(mediaType));
+ }
+
+ @Override
+ public boolean canWrite(Class<?> clazz, MediaType mediaType) {
+ return (this.objectMapper.canSerialize(clazz) && canWrite(mediaType));
+ }
+
+ @Override
+ protected boolean supports(Class<?> clazz) {
+ // should not be called, since we override canRead/Write instead
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ protected Object readInternal(Class<?> clazz, HttpInputMessage inputMessage)
+ throws IOException, HttpMessageNotReadableException {
+
+ JavaType javaType = getJavaType(clazz);
+ try {
+ return this.objectMapper.readValue(inputMessage.getBody(), javaType);
+ }
+ catch (JsonProcessingException ex) {
+ throw new HttpMessageNotReadableException("Could not read JSON: " + ex.getMessage(), ex);
+ }
+ }
+
+ @Override
+ protected void writeInternal(Object object, HttpOutputMessage outputMessage)
+ throws IOException, HttpMessageNotWritableException {
+
+ JsonEncoding encoding = getJsonEncoding(outputMessage.getHeaders().getContentType());
+ JsonGenerator jsonGenerator =
+ this.objectMapper.getJsonFactory().createJsonGenerator(outputMessage.getBody(), encoding);
+ try {
+ if (this.prefixJson) {
+ jsonGenerator.writeRaw("{} && ");
+ }
+ this.objectMapper.writeValue(jsonGenerator, object);
+ }
+ catch (JsonProcessingException ex) {
+ throw new HttpMessageNotWritableException("Could not write JSON: " + ex.getMessage(), ex);
+ }
+ }
+
+
+ /**
+ * Return the Jackson {@link JavaType} for the specified class.
+ * <p>The default implementation returns {@link ObjectMapper#constructType(java.lang.reflect.Type)},
+ * but this can be overridden in subclasses, to allow for custom generic collection handling.
+ * For instance:
+ * <pre class="code">
+ * protected JavaType getJavaType(Class<?> clazz) {
+ * if (List.class.isAssignableFrom(clazz)) {
+ * return objectMapper.getTypeFactory().constructCollectionType(ArrayList.class, MyBean.class);
+ * } else {
+ * return super.getJavaType(clazz);
+ * }
+ * }
+ * </pre>
+ * @param clazz the class to return the java type for
+ * @return the java type
+ */
+ protected JavaType getJavaType(Class<?> clazz) {
+ return objectMapper.constructType(clazz);
+ }
+
+ /**
+ * Determine the JSON encoding to use for the given content type.
+ * @param contentType the media type as requested by the caller
+ * @return the JSON encoding to use (never <code>null</code>)
+ */
+ protected JsonEncoding getJsonEncoding(MediaType contentType) {
+ if (contentType != null && contentType.getCharSet() != null) {
+ Charset charset = contentType.getCharSet();
+ for (JsonEncoding encoding : JsonEncoding.values()) {
+ if (charset.name().equals(encoding.getJavaName())) {
+ return encoding;
+ }
+ }
+ }
+ return JsonEncoding.UTF8;
+ }
+
+} | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | spring-web/src/main/java/org/springframework/web/client/RestTemplate.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,6 +40,7 @@
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.feed.AtomFeedHttpMessageConverter;
import org.springframework.http.converter.feed.RssChannelHttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter;
import org.springframework.http.converter.xml.SourceHttpMessageConverter;
@@ -118,6 +119,10 @@ public class RestTemplate extends InterceptingHttpAccessor implements RestOperat
private static final boolean jaxb2Present =
ClassUtils.isPresent("javax.xml.bind.Binder", RestTemplate.class.getClassLoader());
+ private static final boolean jackson2Present =
+ ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", RestTemplate.class.getClassLoader()) &&
+ ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", RestTemplate.class.getClassLoader());
+
private static final boolean jacksonPresent =
ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", RestTemplate.class.getClassLoader()) &&
ClassUtils.isPresent("org.codehaus.jackson.JsonGenerator", RestTemplate.class.getClassLoader());
@@ -143,7 +148,10 @@ public RestTemplate() {
if (jaxb2Present) {
this.messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
}
- if (jacksonPresent) {
+ if (jackson2Present) {
+ this.messageConverters.add(new MappingJackson2HttpMessageConverter());
+ }
+ else if (jacksonPresent) {
this.messageConverters.add(new MappingJacksonHttpMessageConverter());
}
if (romePresent) {
@@ -384,7 +392,7 @@ public <T> ResponseEntity<T> exchange(String url, HttpMethod method,
return execute(url, method, requestCallback, responseExtractor, uriVariables);
}
- public <T> ResponseEntity<T> exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity,
+ public <T> ResponseEntity<T> exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity,
Class<T> responseType) throws RestClientException {
HttpEntityRequestCallback requestCallback = new HttpEntityRequestCallback(requestEntity, responseType);
ResponseEntityResponseExtractor<T> responseExtractor = new ResponseEntityResponseExtractor<T>(responseType);
@@ -577,7 +585,7 @@ public void doWithRequest(ClientHttpRequest httpRequest) throws IOException {
}
if (logger.isDebugEnabled()) {
if (requestContentType != null) {
- logger.debug("Writing [" + requestBody + "] as \"" + requestContentType +
+ logger.debug("Writing [" + requestBody + "] as \"" + requestContentType +
"\" using [" + messageConverter + "]");
}
else { | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | spring-web/src/test/java/org/springframework/http/converter/json/MappingJacksonHttpMessageConverterTests.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,29 +23,47 @@
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.codehaus.jackson.map.type.TypeFactory;
import org.codehaus.jackson.type.JavaType;
-import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
import org.springframework.http.MediaType;
import org.springframework.http.MockHttpInputMessage;
import org.springframework.http.MockHttpOutputMessage;
+import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.HttpMessageNotReadableException;
/**
+ * Jackson conversion tests parameterized with Jackson and Jackson 2 converters.
+ *
* @author Arjen Poutsma
+ * @author Rossen Stoyanchev
*/
+@RunWith(Parameterized.class)
public class MappingJacksonHttpMessageConverterTests {
- private MappingJacksonHttpMessageConverter converter;
+ private HttpMessageConverter<Object> converter;
+
+ @Parameters
+ public static Collection<Object[]> handlerTypes() {
+ Object[][] array = new Object[2][1];
+
+ array[0] = new Object[] { new MappingJackson2HttpMessageConverter()};
+ array[1] = new Object[] { new MappingJacksonHttpMessageConverter()};
+
+ return Arrays.asList(array);
+ }
- @Before
- public void setUp() {
- converter = new MappingJacksonHttpMessageConverter();
+ public MappingJacksonHttpMessageConverterTests(HttpMessageConverter<Object> converter) {
+ this.converter = converter;
}
@Test | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2010 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.feed.AtomFeedHttpMessageConverter;
import org.springframework.http.converter.feed.RssChannelHttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter;
import org.springframework.http.converter.xml.SourceHttpMessageConverter;
@@ -65,52 +66,52 @@
import org.w3c.dom.Element;
/**
- * A {@link BeanDefinitionParser} that provides the configuration for the
+ * A {@link BeanDefinitionParser} that provides the configuration for the
* {@code <annotation-driven/>} MVC namespace element.
*
* <p>This class registers the following {@link HandlerMapping}s:</p>
* <ul>
- * <li>{@link RequestMappingHandlerMapping}
+ * <li>{@link RequestMappingHandlerMapping}
* ordered at 0 for mapping requests to annotated controller methods.
- * <li>{@link BeanNameUrlHandlerMapping}
+ * <li>{@link BeanNameUrlHandlerMapping}
* ordered at 2 to map URL paths to controller bean names.
* </ul>
*
- * <p><strong>Note:</strong> Additional HandlerMappings may be registered
- * as a result of using the {@code <view-controller>} or the
+ * <p><strong>Note:</strong> Additional HandlerMappings may be registered
+ * as a result of using the {@code <view-controller>} or the
* {@code <resources>} MVC namespace elements.
- *
+ *
* <p>This class registers the following {@link HandlerAdapter}s:
* <ul>
- * <li>{@link RequestMappingHandlerAdapter}
+ * <li>{@link RequestMappingHandlerAdapter}
* for processing requests with annotated controller methods.
- * <li>{@link HttpRequestHandlerAdapter}
+ * <li>{@link HttpRequestHandlerAdapter}
* for processing requests with {@link HttpRequestHandler}s.
- * <li>{@link SimpleControllerHandlerAdapter}
+ * <li>{@link SimpleControllerHandlerAdapter}
* for processing requests with interface-based {@link Controller}s.
* </ul>
- *
+ *
* <p>This class registers the following {@link HandlerExceptionResolver}s:
* <ul>
- * <li>{@link ExceptionHandlerExceptionResolver} for handling exceptions
+ * <li>{@link ExceptionHandlerExceptionResolver} for handling exceptions
* through @{@link ExceptionHandler} methods.
- * <li>{@link ResponseStatusExceptionResolver} for exceptions annotated
+ * <li>{@link ResponseStatusExceptionResolver} for exceptions annotated
* with @{@link ResponseStatus}.
- * <li>{@link DefaultHandlerExceptionResolver} for resolving known Spring
+ * <li>{@link DefaultHandlerExceptionResolver} for resolving known Spring
* exception types
* </ul>
- *
- * <p>Both the {@link RequestMappingHandlerAdapter} and the
- * {@link ExceptionHandlerExceptionResolver} are configured with default
+ *
+ * <p>Both the {@link RequestMappingHandlerAdapter} and the
+ * {@link ExceptionHandlerExceptionResolver} are configured with default
* instances of the following kind, unless custom instances are provided:
* <ul>
* <li>A {@link DefaultFormattingConversionService}
- * <li>A {@link LocalValidatorFactoryBean} if a JSR-303 implementation is
+ * <li>A {@link LocalValidatorFactoryBean} if a JSR-303 implementation is
* available on the classpath
- * <li>A range of {@link HttpMessageConverter}s depending on what 3rd party
+ * <li>A range of {@link HttpMessageConverter}s depending on what 3rd party
* libraries are available on the classpath.
* </ul>
- *
+ *
* @author Keith Donald
* @author Juergen Hoeller
* @author Arjen Poutsma
@@ -125,6 +126,10 @@ class AnnotationDrivenBeanDefinitionParser implements BeanDefinitionParser {
private static final boolean jaxb2Present =
ClassUtils.isPresent("javax.xml.bind.Binder", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
+ private static final boolean jackson2Present =
+ ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", AnnotationDrivenBeanDefinitionParser.class.getClassLoader()) &&
+ ClassUtils.isPresent("com.fasterxml.jackson.core.JsonGenerator", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
+
private static final boolean jacksonPresent =
ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", AnnotationDrivenBeanDefinitionParser.class.getClassLoader()) &&
ClassUtils.isPresent("org.codehaus.jackson.JsonGenerator", AnnotationDrivenBeanDefinitionParser.class.getClassLoader());
@@ -158,7 +163,7 @@ public BeanDefinition parse(Element element, ParserContext parserContext) {
ManagedList<?> messageConverters = getMessageConverters(element, source, parserContext);
ManagedList<?> argumentResolvers = getArgumentResolvers(element, source, parserContext);
ManagedList<?> returnValueHandlers = getReturnValueHandlers(element, source, parserContext);
-
+
RootBeanDefinition methodAdapterDef = new RootBeanDefinition(RequestMappingHandlerAdapter.class);
methodAdapterDef.setSource(source);
methodAdapterDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
@@ -215,7 +220,7 @@ public BeanDefinition parse(Element element, ParserContext parserContext) {
parserContext.registerComponent(new BeanComponentDefinition(defaultExceptionResolver, defaultExceptionResolverName));
parserContext.registerComponent(new BeanComponentDefinition(mappedCsInterceptorDef, mappedInterceptorName));
- // Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off"
+ // Ensure BeanNameUrlHandlerMapping (SPR-8289) and default HandlerAdapters are not "turned off"
MvcNamespaceUtils.registerDefaultComponents(parserContext, source);
parserContext.popAndRegisterContainingComponent();
@@ -309,7 +314,10 @@ private ManagedList<?> getMessageConverters(Element element, Object source, Pars
messageConverters
.add(createConverterBeanDefinition(Jaxb2RootElementHttpMessageConverter.class, source));
}
- if (jacksonPresent) {
+ if (jackson2Present) {
+ messageConverters.add(createConverterBeanDefinition(MappingJackson2HttpMessageConverter.class, source));
+ }
+ else if (jacksonPresent) {
messageConverters.add(createConverterBeanDefinition(MappingJacksonHttpMessageConverter.class, source));
}
if (romePresent) { | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java | @@ -41,6 +41,7 @@
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.feed.AtomFeedHttpMessageConverter;
import org.springframework.http.converter.feed.RssChannelHttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
import org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter;
import org.springframework.http.converter.xml.SourceHttpMessageConverter;
@@ -74,59 +75,59 @@
/**
* This is the main class providing the configuration behind the MVC Java config.
- * It is typically imported by adding {@link EnableWebMvc @EnableWebMvc} to an
- * application {@link Configuration @Configuration} class. An alternative more
+ * It is typically imported by adding {@link EnableWebMvc @EnableWebMvc} to an
+ * application {@link Configuration @Configuration} class. An alternative more
* advanced option is to extend directly from this class and override methods as
- * necessary remembering to add {@link Configuration @Configuration} to the
+ * necessary remembering to add {@link Configuration @Configuration} to the
* subclass and {@link Bean @Bean} to overridden {@link Bean @Bean} methods.
* For more details see the Javadoc of {@link EnableWebMvc @EnableWebMvc}.
- *
+ *
* <p>This class registers the following {@link HandlerMapping}s:</p>
* <ul>
- * <li>{@link RequestMappingHandlerMapping}
+ * <li>{@link RequestMappingHandlerMapping}
* ordered at 0 for mapping requests to annotated controller methods.
- * <li>{@link HandlerMapping}
+ * <li>{@link HandlerMapping}
* ordered at 1 to map URL paths directly to view names.
- * <li>{@link BeanNameUrlHandlerMapping}
+ * <li>{@link BeanNameUrlHandlerMapping}
* ordered at 2 to map URL paths to controller bean names.
- * <li>{@link HandlerMapping}
+ * <li>{@link HandlerMapping}
* ordered at {@code Integer.MAX_VALUE-1} to serve static resource requests.
- * <li>{@link HandlerMapping}
+ * <li>{@link HandlerMapping}
* ordered at {@code Integer.MAX_VALUE} to forward requests to the default servlet.
* </ul>
*
* <p>Registers these {@link HandlerAdapter}s:
* <ul>
- * <li>{@link RequestMappingHandlerAdapter}
+ * <li>{@link RequestMappingHandlerAdapter}
* for processing requests with annotated controller methods.
- * <li>{@link HttpRequestHandlerAdapter}
+ * <li>{@link HttpRequestHandlerAdapter}
* for processing requests with {@link HttpRequestHandler}s.
- * <li>{@link SimpleControllerHandlerAdapter}
+ * <li>{@link SimpleControllerHandlerAdapter}
* for processing requests with interface-based {@link Controller}s.
* </ul>
*
* <p>Registers a {@link HandlerExceptionResolverComposite} with this chain of
* exception resolvers:
* <ul>
- * <li>{@link ExceptionHandlerExceptionResolver} for handling exceptions
+ * <li>{@link ExceptionHandlerExceptionResolver} for handling exceptions
* through @{@link ExceptionHandler} methods.
- * <li>{@link ResponseStatusExceptionResolver} for exceptions annotated
+ * <li>{@link ResponseStatusExceptionResolver} for exceptions annotated
* with @{@link ResponseStatus}.
- * <li>{@link DefaultHandlerExceptionResolver} for resolving known Spring
+ * <li>{@link DefaultHandlerExceptionResolver} for resolving known Spring
* exception types
* </ul>
*
- * <p>Both the {@link RequestMappingHandlerAdapter} and the
- * {@link ExceptionHandlerExceptionResolver} are configured with default
+ * <p>Both the {@link RequestMappingHandlerAdapter} and the
+ * {@link ExceptionHandlerExceptionResolver} are configured with default
* instances of the following kind, unless custom instances are provided:
* <ul>
* <li>A {@link DefaultFormattingConversionService}
- * <li>A {@link LocalValidatorFactoryBean} if a JSR-303 implementation is
+ * <li>A {@link LocalValidatorFactoryBean} if a JSR-303 implementation is
* available on the classpath
- * <li>A range of {@link HttpMessageConverter}s depending on the 3rd party
+ * <li>A range of {@link HttpMessageConverter}s depending on the 3rd party
* libraries available on the classpath.
* </ul>
- *
+ *
* @see EnableWebMvc
* @see WebMvcConfigurer
* @see WebMvcConfigurerAdapter
@@ -151,9 +152,9 @@ public void setServletContext(ServletContext servletContext) {
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
-
+
/**
- * Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
+ * Return a {@link RequestMappingHandlerMapping} ordered at 0 for mapping
* requests to annotated controllers.
*/
@Bean
@@ -163,11 +164,11 @@ public RequestMappingHandlerMapping requestMappingHandlerMapping() {
handlerMapping.setInterceptors(getInterceptors());
return handlerMapping;
}
-
+
/**
- * Provide access to the shared handler interceptors used to configure
- * {@link HandlerMapping} instances with. This method cannot be overridden,
- * use {@link #addInterceptors(InterceptorRegistry)} instead.
+ * Provide access to the shared handler interceptors used to configure
+ * {@link HandlerMapping} instances with. This method cannot be overridden,
+ * use {@link #addInterceptors(InterceptorRegistry)} instead.
*/
protected final Object[] getInterceptors() {
if (interceptors == null) {
@@ -178,25 +179,25 @@ protected final Object[] getInterceptors() {
}
return interceptors.toArray();
}
-
+
/**
- * Override this method to add Spring MVC interceptors for
+ * Override this method to add Spring MVC interceptors for
* pre- and post-processing of controller invocation.
* @see InterceptorRegistry
*/
protected void addInterceptors(InterceptorRegistry registry) {
}
/**
- * Return a handler mapping ordered at 1 to map URL paths directly to
- * view names. To configure view controllers, override
- * {@link #addViewControllers}.
+ * Return a handler mapping ordered at 1 to map URL paths directly to
+ * view names. To configure view controllers, override
+ * {@link #addViewControllers}.
*/
@Bean
public HandlerMapping viewControllerHandlerMapping() {
ViewControllerRegistry registry = new ViewControllerRegistry();
addViewControllers(registry);
-
+
AbstractHandlerMapping handlerMapping = registry.getHandlerMapping();
handlerMapping = handlerMapping != null ? handlerMapping : new EmptyHandlerMapping();
handlerMapping.setInterceptors(getInterceptors());
@@ -209,9 +210,9 @@ public HandlerMapping viewControllerHandlerMapping() {
*/
protected void addViewControllers(ViewControllerRegistry registry) {
}
-
+
/**
- * Return a {@link BeanNameUrlHandlerMapping} ordered at 2 to map URL
+ * Return a {@link BeanNameUrlHandlerMapping} ordered at 2 to map URL
* paths to controller bean names.
*/
@Bean
@@ -223,8 +224,8 @@ public BeanNameUrlHandlerMapping beanNameHandlerMapping() {
}
/**
- * Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped
- * resource handlers. To configure resource handling, override
+ * Return a handler mapping ordered at Integer.MAX_VALUE-1 with mapped
+ * resource handlers. To configure resource handling, override
* {@link #addResourceHandlers}.
*/
@Bean
@@ -237,16 +238,16 @@ public HandlerMapping resourceHandlerMapping() {
}
/**
- * Override this method to add resource handlers for serving static resources.
+ * Override this method to add resource handlers for serving static resources.
* @see ResourceHandlerRegistry
*/
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
}
/**
- * Return a handler mapping ordered at Integer.MAX_VALUE with a mapped
- * default servlet handler. To configure "default" Servlet handling,
- * override {@link #configureDefaultServletHandling}.
+ * Return a handler mapping ordered at Integer.MAX_VALUE with a mapped
+ * default servlet handler. To configure "default" Servlet handling,
+ * override {@link #configureDefaultServletHandling}.
*/
@Bean
public HandlerMapping defaultServletHandlerMapping() {
@@ -258,15 +259,15 @@ public HandlerMapping defaultServletHandlerMapping() {
}
/**
- * Override this method to configure "default" Servlet handling.
+ * Override this method to configure "default" Servlet handling.
* @see DefaultServletHandlerConfigurer
*/
protected void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
}
/**
- * Returns a {@link RequestMappingHandlerAdapter} for processing requests
- * through annotated controller methods. Consider overriding one of these
+ * Returns a {@link RequestMappingHandlerAdapter} for processing requests
+ * through annotated controller methods. Consider overriding one of these
* other more fine-grained methods:
* <ul>
* <li>{@link #addArgumentResolvers} for adding custom argument resolvers.
@@ -279,13 +280,13 @@ public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
ConfigurableWebBindingInitializer webBindingInitializer = new ConfigurableWebBindingInitializer();
webBindingInitializer.setConversionService(mvcConversionService());
webBindingInitializer.setValidator(mvcValidator());
-
+
List<HandlerMethodArgumentResolver> argumentResolvers = new ArrayList<HandlerMethodArgumentResolver>();
addArgumentResolvers(argumentResolvers);
List<HandlerMethodReturnValueHandler> returnValueHandlers = new ArrayList<HandlerMethodReturnValueHandler>();
addReturnValueHandlers(returnValueHandlers);
-
+
RequestMappingHandlerAdapter adapter = new RequestMappingHandlerAdapter();
adapter.setMessageConverters(getMessageConverters());
adapter.setWebBindingInitializer(webBindingInitializer);
@@ -295,40 +296,40 @@ public RequestMappingHandlerAdapter requestMappingHandlerAdapter() {
}
/**
- * Add custom {@link HandlerMethodArgumentResolver}s to use in addition to
+ * Add custom {@link HandlerMethodArgumentResolver}s to use in addition to
* the ones registered by default.
- * <p>Custom argument resolvers are invoked before built-in resolvers
- * except for those that rely on the presence of annotations (e.g.
- * {@code @RequestParameter}, {@code @PathVariable}, etc.).
- * The latter can be customized by configuring the
- * {@link RequestMappingHandlerAdapter} directly.
- * @param argumentResolvers the list of custom converters;
+ * <p>Custom argument resolvers are invoked before built-in resolvers
+ * except for those that rely on the presence of annotations (e.g.
+ * {@code @RequestParameter}, {@code @PathVariable}, etc.).
+ * The latter can be customized by configuring the
+ * {@link RequestMappingHandlerAdapter} directly.
+ * @param argumentResolvers the list of custom converters;
* initially an empty list.
*/
protected void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
}
/**
- * Add custom {@link HandlerMethodReturnValueHandler}s in addition to the
+ * Add custom {@link HandlerMethodReturnValueHandler}s in addition to the
* ones registered by default.
- * <p>Custom return value handlers are invoked before built-in ones except
- * for those that rely on the presence of annotations (e.g.
- * {@code @ResponseBody}, {@code @ModelAttribute}, etc.).
- * The latter can be customized by configuring the
+ * <p>Custom return value handlers are invoked before built-in ones except
+ * for those that rely on the presence of annotations (e.g.
+ * {@code @ResponseBody}, {@code @ModelAttribute}, etc.).
+ * The latter can be customized by configuring the
* {@link RequestMappingHandlerAdapter} directly.
- * @param returnValueHandlers the list of custom handlers;
+ * @param returnValueHandlers the list of custom handlers;
* initially an empty list.
*/
protected void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers) {
}
/**
- * Provides access to the shared {@link HttpMessageConverter}s used by the
- * {@link RequestMappingHandlerAdapter} and the
- * {@link ExceptionHandlerExceptionResolver}.
- * This method cannot be overridden.
+ * Provides access to the shared {@link HttpMessageConverter}s used by the
+ * {@link RequestMappingHandlerAdapter} and the
+ * {@link ExceptionHandlerExceptionResolver}.
+ * This method cannot be overridden.
* Use {@link #configureMessageConverters(List)} instead.
- * Also see {@link #addDefaultHttpMessageConverters(List)} that can be
+ * Also see {@link #addDefaultHttpMessageConverters(List)} that can be
* used to add default message converters.
*/
protected final List<HttpMessageConverter<?>> getMessageConverters() {
@@ -343,21 +344,21 @@ protected final List<HttpMessageConverter<?>> getMessageConverters() {
}
/**
- * Override this method to add custom {@link HttpMessageConverter}s to use
- * with the {@link RequestMappingHandlerAdapter} and the
- * {@link ExceptionHandlerExceptionResolver}. Adding converters to the
+ * Override this method to add custom {@link HttpMessageConverter}s to use
+ * with the {@link RequestMappingHandlerAdapter} and the
+ * {@link ExceptionHandlerExceptionResolver}. Adding converters to the
* list turns off the default converters that would otherwise be registered
- * by default. Also see {@link #addDefaultHttpMessageConverters(List)} that
+ * by default. Also see {@link #addDefaultHttpMessageConverters(List)} that
* can be used to add default message converters.
- * @param converters a list to add message converters to;
+ * @param converters a list to add message converters to;
* initially an empty list.
*/
protected void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
}
/**
- * Adds a set of default HttpMessageConverter instances to the given list.
- * Subclasses can call this method from {@link #configureMessageConverters(List)}.
+ * Adds a set of default HttpMessageConverter instances to the given list.
+ * Subclasses can call this method from {@link #configureMessageConverters(List)}.
* @param messageConverters the list to add the default message converters to
*/
protected final void addDefaultHttpMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
@@ -374,18 +375,21 @@ protected final void addDefaultHttpMessageConverters(List<HttpMessageConverter<?
if (ClassUtils.isPresent("javax.xml.bind.Binder", classLoader)) {
messageConverters.add(new Jaxb2RootElementHttpMessageConverter());
}
- if (ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", classLoader)) {
+ if (ClassUtils.isPresent("com.fasterxml.jackson.databind.ObjectMapper", classLoader)) {
+ messageConverters.add(new MappingJackson2HttpMessageConverter());
+ }
+ else if (ClassUtils.isPresent("org.codehaus.jackson.map.ObjectMapper", classLoader)) {
messageConverters.add(new MappingJacksonHttpMessageConverter());
}
if (ClassUtils.isPresent("com.sun.syndication.feed.WireFeed", classLoader)) {
messageConverters.add(new AtomFeedHttpMessageConverter());
messageConverters.add(new RssChannelHttpMessageConverter());
}
}
-
+
/**
- * Returns a {@link FormattingConversionService} for use with annotated
- * controller methods and the {@code spring:eval} JSP tag.
+ * Returns a {@link FormattingConversionService} for use with annotated
+ * controller methods and the {@code spring:eval} JSP tag.
* Also see {@link #addFormatters} as an alternative to overriding this method.
*/
@Bean
@@ -402,11 +406,11 @@ protected void addFormatters(FormatterRegistry registry) {
}
/**
- * Returns a global {@link Validator} instance for example for validating
+ * Returns a global {@link Validator} instance for example for validating
* {@code @ModelAttribute} and {@code @RequestBody} method arguments.
* Delegates to {@link #getValidator()} first and if that returns {@code null}
* checks the classpath for the presence of a JSR-303 implementations
- * before creating a {@code LocalValidatorFactoryBean}.If a JSR-303
+ * before creating a {@code LocalValidatorFactoryBean}.If a JSR-303
* implementation is not available, a no-op {@link Validator} is returned.
*/
@Bean
@@ -446,7 +450,7 @@ protected Validator getValidator() {
}
/**
- * Returns a {@link HttpRequestHandlerAdapter} for processing requests
+ * Returns a {@link HttpRequestHandlerAdapter} for processing requests
* with {@link HttpRequestHandler}s.
*/
@Bean
@@ -455,7 +459,7 @@ public HttpRequestHandlerAdapter httpRequestHandlerAdapter() {
}
/**
- * Returns a {@link SimpleControllerHandlerAdapter} for processing requests
+ * Returns a {@link SimpleControllerHandlerAdapter} for processing requests
* with interface-based controllers.
*/
@Bean
@@ -465,51 +469,51 @@ public SimpleControllerHandlerAdapter simpleControllerHandlerAdapter() {
/**
* Returns a {@link HandlerExceptionResolverComposite} containing a list
- * of exception resolvers obtained either through
+ * of exception resolvers obtained either through
* {@link #configureHandlerExceptionResolvers(List)} or through
* {@link #addDefaultHandlerExceptionResolvers(List)}.
* <p><strong>Note:</strong> This method cannot be made final due to CGLib
* constraints. Rather than overriding it, consider overriding
- * {@link #configureHandlerExceptionResolvers(List)}, which allows
+ * {@link #configureHandlerExceptionResolvers(List)}, which allows
* providing a list of resolvers.
*/
@Bean
public HandlerExceptionResolver handlerExceptionResolver() {
List<HandlerExceptionResolver> exceptionResolvers = new ArrayList<HandlerExceptionResolver>();
configureHandlerExceptionResolvers(exceptionResolvers);
-
+
if (exceptionResolvers.isEmpty()) {
addDefaultHandlerExceptionResolvers(exceptionResolvers);
}
-
+
HandlerExceptionResolverComposite composite = new HandlerExceptionResolverComposite();
composite.setOrder(0);
composite.setExceptionResolvers(exceptionResolvers);
return composite;
}
/**
- * Override this method to configure the list of
- * {@link HandlerExceptionResolver}s to use. Adding resolvers to the list
- * turns off the default resolvers that would otherwise be registered by
- * default. Also see {@link #addDefaultHandlerExceptionResolvers(List)}
+ * Override this method to configure the list of
+ * {@link HandlerExceptionResolver}s to use. Adding resolvers to the list
+ * turns off the default resolvers that would otherwise be registered by
+ * default. Also see {@link #addDefaultHandlerExceptionResolvers(List)}
* that can be used to add the default exception resolvers.
- * @param exceptionResolvers a list to add exception resolvers to;
+ * @param exceptionResolvers a list to add exception resolvers to;
* initially an empty list.
*/
protected void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
}
/**
- * A method available to subclasses for adding default
+ * A method available to subclasses for adding default
* {@link HandlerExceptionResolver}s.
* <p>Adds the following exception resolvers:
* <ul>
- * <li>{@link ExceptionHandlerExceptionResolver}
+ * <li>{@link ExceptionHandlerExceptionResolver}
* for handling exceptions through @{@link ExceptionHandler} methods.
- * <li>{@link ResponseStatusExceptionResolver}
+ * <li>{@link ResponseStatusExceptionResolver}
* for exceptions annotated with @{@link ResponseStatus}.
- * <li>{@link DefaultHandlerExceptionResolver}
+ * <li>{@link DefaultHandlerExceptionResolver}
* for resolving known Spring exception types
* </ul>
*/
@@ -524,11 +528,11 @@ protected final void addDefaultHandlerExceptionResolvers(List<HandlerExceptionRe
}
private final static class EmptyHandlerMapping extends AbstractHandlerMapping {
-
+
@Override
protected Object getHandlerInternal(HttpServletRequest request) throws Exception {
return null;
}
}
-
+
} | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | spring-webmvc/src/main/java/org/springframework/web/servlet/view/json/MappingJackson2JsonView.java | @@ -0,0 +1,220 @@
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.web.servlet.view.json;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import com.fasterxml.jackson.core.JsonEncoding;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.springframework.util.Assert;
+import org.springframework.util.CollectionUtils;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.servlet.View;
+import org.springframework.web.servlet.view.AbstractView;
+
+/**
+ * Spring MVC {@link View} that renders JSON content by serializing the model for the current request
+ * using <a href="http://jackson.codehaus.org/">Jackson 2's</a> {@link ObjectMapper}.
+ *
+ * <p>By default, the entire contents of the model map (with the exception of framework-specific classes)
+ * will be encoded as JSON. If the model contains only one key, you can have it extracted encoded as JSON
+ * alone via {@link #setExtractValueFromSingleKeyModel}.
+ *
+ * @author Jeremy Grelle
+ * @author Arjen Poutsma
+ * @author Rossen Stoyanchev
+ * @since 3.2
+ * @see org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
+ */
+public class MappingJackson2JsonView extends AbstractView {
+
+ /**
+ * Default content type. Overridable as bean property.
+ */
+ public static final String DEFAULT_CONTENT_TYPE = "application/json";
+
+
+ private ObjectMapper objectMapper = new ObjectMapper();
+
+ private JsonEncoding encoding = JsonEncoding.UTF8;
+
+ private boolean prefixJson = false;
+
+ private Set<String> modelKeys;
+
+ private boolean extractValueFromSingleKeyModel = false;
+
+ private boolean disableCaching = true;
+
+
+ /**
+ * Construct a new {@code JacksonJsonView}, setting the content type to {@code application/json}.
+ */
+ public MappingJackson2JsonView() {
+ setContentType(DEFAULT_CONTENT_TYPE);
+ setExposePathVariables(false);
+ }
+
+
+ /**
+ * Sets the {@code ObjectMapper} for this view.
+ * If not set, a default {@link ObjectMapper#ObjectMapper() ObjectMapper} is used.
+ * <p>Setting a custom-configured {@code ObjectMapper} is one way to take further control
+ * of the JSON serialization process. For example, an extended {@code SerializerFactory}
+ * can be configured that provides custom serializers for specific types. The other option
+ * for refining the serialization process is to use Jackson's provided annotations on the
+ * types to be serialized, in which case a custom-configured ObjectMapper is unnecessary.
+ */
+ public void setObjectMapper(ObjectMapper objectMapper) {
+ Assert.notNull(objectMapper, "'objectMapper' must not be null");
+ this.objectMapper = objectMapper;
+ }
+
+ /**
+ * Set the {@code JsonEncoding} for this converter.
+ * By default, {@linkplain JsonEncoding#UTF8 UTF-8} is used.
+ */
+ public void setEncoding(JsonEncoding encoding) {
+ Assert.notNull(encoding, "'encoding' must not be null");
+ this.encoding = encoding;
+ }
+
+ /**
+ * Indicates whether the JSON output by this view should be prefixed with <tt>"{} && "</tt>.
+ * Default is false.
+ * <p>Prefixing the JSON string in this manner is used to help prevent JSON Hijacking.
+ * The prefix renders the string syntactically invalid as a script so that it cannot be hijacked.
+ * This prefix does not affect the evaluation of JSON, but if JSON validation is performed
+ * on the string, the prefix would need to be ignored.
+ */
+ public void setPrefixJson(boolean prefixJson) {
+ this.prefixJson = prefixJson;
+ }
+
+ /**
+ * Set the attribute in the model that should be rendered by this view.
+ * When set, all other model attributes will be ignored.
+ */
+ public void setModelKey(String modelKey) {
+ this.modelKeys = Collections.singleton(modelKey);
+ }
+
+ /**
+ * Set the attributes in the model that should be rendered by this view.
+ * When set, all other model attributes will be ignored.
+ */
+ public void setModelKeys(Set<String> modelKeys) {
+ this.modelKeys = modelKeys;
+ }
+
+ /**
+ * Return the attributes in the model that should be rendered by this view.
+ */
+ public Set<String> getModelKeys() {
+ return this.modelKeys;
+ }
+
+ /**
+ * Set the attributes in the model that should be rendered by this view.
+ * When set, all other model attributes will be ignored.
+ * @deprecated use {@link #setModelKeys(Set)} instead
+ */
+ @Deprecated
+ public void setRenderedAttributes(Set<String> renderedAttributes) {
+ this.modelKeys = renderedAttributes;
+ }
+
+ /**
+ * Return the attributes in the model that should be rendered by this view.
+ * @deprecated use {@link #getModelKeys()} instead
+ */
+ @Deprecated
+ public Set<String> getRenderedAttributes() {
+ return this.modelKeys;
+ }
+
+ /**
+ * Set whether to serialize models containing a single attribute as a map or whether to
+ * extract the single value from the model and serialize it directly.
+ * <p>The effect of setting this flag is similar to using {@code MappingJacksonHttpMessageConverter}
+ * with an {@code @ResponseBody} request-handling method.
+ * <p>Default is {@code false}.
+ */
+ public void setExtractValueFromSingleKeyModel(boolean extractValueFromSingleKeyModel) {
+ this.extractValueFromSingleKeyModel = extractValueFromSingleKeyModel;
+ }
+
+ /**
+ * Disables caching of the generated JSON.
+ * <p>Default is {@code true}, which will prevent the client from caching the generated JSON.
+ */
+ public void setDisableCaching(boolean disableCaching) {
+ this.disableCaching = disableCaching;
+ }
+
+
+ @Override
+ protected void prepareResponse(HttpServletRequest request, HttpServletResponse response) {
+ response.setContentType(getContentType());
+ response.setCharacterEncoding(this.encoding.getJavaName());
+ if (this.disableCaching) {
+ response.addHeader("Pragma", "no-cache");
+ response.addHeader("Cache-Control", "no-cache, no-store, max-age=0");
+ response.addDateHeader("Expires", 1L);
+ }
+ }
+
+ @Override
+ protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+
+ Object value = filterModel(model);
+ JsonGenerator generator =
+ this.objectMapper.getJsonFactory().createJsonGenerator(response.getOutputStream(), this.encoding);
+ if (this.prefixJson) {
+ generator.writeRaw("{} && ");
+ }
+ this.objectMapper.writeValue(generator, value);
+ }
+
+ /**
+ * Filters out undesired attributes from the given model.
+ * The return value can be either another {@link Map} or a single value object.
+ * <p>The default implementation removes {@link BindingResult} instances and entries
+ * not included in the {@link #setRenderedAttributes renderedAttributes} property.
+ * @param model the model, as passed on to {@link #renderMergedOutputModel}
+ * @return the object to be rendered
+ */
+ protected Object filterModel(Map<String, Object> model) {
+ Map<String, Object> result = new HashMap<String, Object>(model.size());
+ Set<String> renderedAttributes = (!CollectionUtils.isEmpty(this.modelKeys) ? this.modelKeys : model.keySet());
+ for (Map.Entry<String, Object> entry : model.entrySet()) {
+ if (!(entry.getValue() instanceof BindingResult) && renderedAttributes.contains(entry.getKey())) {
+ result.put(entry.getKey(), entry.getValue());
+ }
+ }
+ return (this.extractValueFromSingleKeyModel && result.size() == 1 ? result.values().iterator().next() : result);
+ }
+
+} | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | spring-webmvc/src/test/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupportTests.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
import org.springframework.format.FormatterRegistry;
import org.springframework.format.support.FormattingConversionService;
import org.springframework.http.converter.HttpMessageConverter;
-import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter;
+import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockServletContext;
import org.springframework.stereotype.Controller;
@@ -73,12 +73,12 @@ public class WebMvcConfigurationSupportTests {
public void setUp() {
mvcConfiguration = new TestWebMvcConfiguration();
}
-
+
@Test
public void requestMappingHandlerMapping() throws Exception {
StaticWebApplicationContext cxt = new StaticWebApplicationContext();
cxt.registerSingleton("controller", TestController.class);
-
+
RequestMappingHandlerMapping handlerMapping = mvcConfiguration.requestMappingHandlerMapping();
assertEquals(0, handlerMapping.getOrder());
@@ -95,7 +95,7 @@ public void emptyViewControllerHandlerMapping() {
assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
}
-
+
@Test
public void beanNameHandlerMapping() throws Exception {
StaticWebApplicationContext cxt = new StaticWebApplicationContext();
@@ -112,7 +112,7 @@ public void beanNameHandlerMapping() throws Exception {
assertEquals(2, chain.getInterceptors().length);
assertEquals(ConversionServiceExposingInterceptor.class, chain.getInterceptors()[1].getClass());
}
-
+
@Test
public void emptyResourceHandlerMapping() {
mvcConfiguration.setApplicationContext(new StaticWebApplicationContext());
@@ -121,7 +121,7 @@ public void emptyResourceHandlerMapping() {
assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
}
-
+
@Test
public void emptyDefaultServletHandlerMapping() {
mvcConfiguration.setServletContext(new MockServletContext());
@@ -130,7 +130,7 @@ public void emptyDefaultServletHandlerMapping() {
assertEquals(Integer.MAX_VALUE, handlerMapping.getOrder());
assertTrue(handlerMapping.getClass().getName().endsWith("EmptyHandlerMapping"));
}
-
+
@Test
public void requestMappingHandlerAdapter() throws Exception {
RequestMappingHandlerAdapter adapter = mvcConfiguration.requestMappingHandlerAdapter();
@@ -145,63 +145,63 @@ public void requestMappingHandlerAdapter() throws Exception {
ConversionService conversionService = initializer.getConversionService();
assertNotNull(conversionService);
assertTrue(conversionService instanceof FormattingConversionService);
-
+
Validator validator = initializer.getValidator();
assertNotNull(validator);
assertTrue(validator instanceof LocalValidatorFactoryBean);
-
+
assertEquals(false, new DirectFieldAccessor(adapter).getPropertyValue("ignoreDefaultModelOnRedirect"));
}
-
+
@Test
public void handlerExceptionResolver() throws Exception {
- HandlerExceptionResolverComposite compositeResolver =
+ HandlerExceptionResolverComposite compositeResolver =
(HandlerExceptionResolverComposite) mvcConfiguration.handlerExceptionResolver();
-
+
assertEquals(0, compositeResolver.getOrder());
List<HandlerExceptionResolver> expectedResolvers = new ArrayList<HandlerExceptionResolver>();
mvcConfiguration.addDefaultHandlerExceptionResolvers(expectedResolvers);
assertEquals(expectedResolvers.size(), compositeResolver.getExceptionResolvers().size());
}
-
- @Test
+
+ @Test
public void webMvcConfigurerExtensionHooks() throws Exception {
-
+
StaticWebApplicationContext appCxt = new StaticWebApplicationContext();
appCxt.setServletContext(new MockServletContext(new FileSystemResourceLoader()));
appCxt.registerSingleton("controller", TestController.class);
WebConfig webConfig = new WebConfig();
webConfig.setApplicationContext(appCxt);
webConfig.setServletContext(appCxt.getServletContext());
-
+
String actual = webConfig.mvcConversionService().convert(new TestBean(), String.class);
assertEquals("converted", actual);
RequestMappingHandlerAdapter adapter = webConfig.requestMappingHandlerAdapter();
assertEquals(1, adapter.getMessageConverters().size());
-
+
ConfigurableWebBindingInitializer initializer = (ConfigurableWebBindingInitializer) adapter.getWebBindingInitializer();
assertNotNull(initializer);
-
+
BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(null, "");
initializer.getValidator().validate(null, bindingResult);
assertEquals("invalid", bindingResult.getAllErrors().get(0).getCode());
@SuppressWarnings("unchecked")
- List<HandlerMethodArgumentResolver> argResolvers= (List<HandlerMethodArgumentResolver>)
+ List<HandlerMethodArgumentResolver> argResolvers= (List<HandlerMethodArgumentResolver>)
new DirectFieldAccessor(adapter).getPropertyValue("customArgumentResolvers");
assertEquals(1, argResolvers.size());
@SuppressWarnings("unchecked")
- List<HandlerMethodReturnValueHandler> handlers = (List<HandlerMethodReturnValueHandler>)
+ List<HandlerMethodReturnValueHandler> handlers = (List<HandlerMethodReturnValueHandler>)
new DirectFieldAccessor(adapter).getPropertyValue("customReturnValueHandlers");
assertEquals(1, handlers.size());
-
+
HandlerExceptionResolverComposite composite = (HandlerExceptionResolverComposite) webConfig.handlerExceptionResolver();
assertEquals(1, composite.getExceptionResolvers().size());
-
+
RequestMappingHandlerMapping rmHandlerMapping = webConfig.requestMappingHandlerMapping();
rmHandlerMapping.setApplicationContext(appCxt);
HandlerExecutionChain chain = rmHandlerMapping.getHandler(new MockHttpServletRequest("GET", "/"));
@@ -234,23 +234,23 @@ public void webMvcConfigurerExtensionHooks() throws Exception {
@Controller
private static class TestController {
-
+
@SuppressWarnings("unused")
@RequestMapping("/")
public void handle() {
}
}
private static class TestWebMvcConfiguration extends WebMvcConfigurationSupport {
-
+
}
-
+
/**
- * The purpose of this class is to test that an implementation of a {@link WebMvcConfigurer}
+ * The purpose of this class is to test that an implementation of a {@link WebMvcConfigurer}
* can also apply customizations by extension from {@link WebMvcConfigurationSupport}.
*/
private class WebConfig extends WebMvcConfigurationSupport implements WebMvcConfigurer {
-
+
@Override
public void addFormatters(FormatterRegistry registry) {
registry.addConverter(new Converter<TestBean, String>() {
@@ -262,7 +262,7 @@ public String convert(TestBean source) {
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
- converters.add(new MappingJacksonHttpMessageConverter());
+ converters.add(new MappingJackson2HttpMessageConverter());
}
@Override
@@ -312,5 +312,5 @@ public void configureDefaultServletHandling(DefaultServletHandlerConfigurer conf
configurer.enable("default");
}
}
-
+
} | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | spring-webmvc/src/test/java/org/springframework/web/servlet/view/json/MappingJackson2JsonViewTest.java | @@ -0,0 +1,352 @@
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.web.servlet.view.json;
+
+import static org.easymock.EasyMock.createMock;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mozilla.javascript.Context;
+import org.mozilla.javascript.ContextFactory;
+import org.mozilla.javascript.ScriptableObject;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.validation.BindingResult;
+
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.BeanProperty;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.cfg.SerializerFactoryConfig;
+import com.fasterxml.jackson.databind.ser.BasicSerializerFactory;
+import com.fasterxml.jackson.databind.ser.BeanSerializerFactory;
+import com.fasterxml.jackson.databind.ser.SerializerFactory;
+import com.fasterxml.jackson.databind.ser.Serializers;
+
+/**
+ * @author Jeremy Grelle
+ * @author Arjen Poutsma
+ * @author Rossen Stoyanchev
+ */
+public class MappingJackson2JsonViewTest {
+
+ private MappingJackson2JsonView view;
+
+ private MockHttpServletRequest request;
+
+ private MockHttpServletResponse response;
+
+ private Context jsContext;
+
+ private ScriptableObject jsScope;
+
+ @Before
+ public void setUp() {
+ request = new MockHttpServletRequest();
+ response = new MockHttpServletResponse();
+
+ jsContext = ContextFactory.getGlobal().enterContext();
+ jsScope = jsContext.initStandardObjects();
+
+ view = new MappingJackson2JsonView();
+ }
+
+ @Test
+ public void isExposePathVars() {
+ assertEquals("Must not expose path variables", false, view.isExposePathVariables());
+ }
+
+ @Test
+ public void renderSimpleMap() throws Exception {
+
+ Map<String, Object> model = new HashMap<String, Object>();
+ model.put("bindingResult", createMock("binding_result", BindingResult.class));
+ model.put("foo", "bar");
+
+ view.render(model, request, response);
+
+ assertEquals("no-cache", response.getHeader("Pragma"));
+ assertEquals("no-cache, no-store, max-age=0", response.getHeader("Cache-Control"));
+ assertNotNull(response.getHeader("Expires"));
+
+ assertEquals(MappingJacksonJsonView.DEFAULT_CONTENT_TYPE, response.getContentType());
+
+ String jsonResult = response.getContentAsString();
+ assertTrue(jsonResult.length() > 0);
+
+ validateResult();
+ }
+
+ @Test
+ public void renderCaching() throws Exception {
+ view.setDisableCaching(false);
+
+ Map<String, Object> model = new HashMap<String, Object>();
+ model.put("bindingResult", createMock("binding_result", BindingResult.class));
+ model.put("foo", "bar");
+
+ view.render(model, request, response);
+
+ assertNull(response.getHeader("Pragma"));
+ assertNull(response.getHeader("Cache-Control"));
+ assertNull(response.getHeader("Expires"));
+ }
+
+ @Test
+ public void renderSimpleMapPrefixed() throws Exception {
+ view.setPrefixJson(true);
+ renderSimpleMap();
+ }
+
+ @Test
+ public void renderSimpleBean() throws Exception {
+
+ Object bean = new TestBeanSimple();
+ Map<String, Object> model = new HashMap<String, Object>();
+ model.put("bindingResult", createMock("binding_result", BindingResult.class));
+ model.put("foo", bean);
+
+ view.render(model, request, response);
+
+ assertTrue(response.getContentAsString().length() > 0);
+
+ validateResult();
+ }
+
+ @Test
+ public void renderSimpleBeanPrefixed() throws Exception {
+
+ view.setPrefixJson(true);
+ renderSimpleBean();
+ }
+
+ @Test
+ public void renderWithCustomSerializerLocatedByAnnotation() throws Exception {
+
+ Object bean = new TestBeanSimpleAnnotated();
+ Map<String, Object> model = new HashMap<String, Object>();
+ model.put("foo", bean);
+
+ view.render(model, request, response);
+
+ assertTrue(response.getContentAsString().length() > 0);
+ assertEquals("{\"foo\":{\"testBeanSimple\":\"custom\"}}", response.getContentAsString());
+
+ validateResult();
+ }
+
+ @Test
+ public void renderWithCustomSerializerLocatedByFactory() throws Exception {
+
+ SerializerFactory factory = new DelegatingSerializerFactory(null);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializerFactory(factory);
+ view.setObjectMapper(mapper);
+
+ Object bean = new TestBeanSimple();
+ Map<String, Object> model = new HashMap<String, Object>();
+ model.put("foo", bean);
+ model.put("bar", new TestChildBean());
+
+ view.render(model, request, response);
+
+ String result = response.getContentAsString();
+ assertTrue(result.length() > 0);
+ assertTrue(result.contains("\"foo\":{\"testBeanSimple\":\"custom\"}"));
+
+ validateResult();
+ }
+
+ @Test
+ public void renderOnlyIncludedAttributes() throws Exception {
+
+ Set<String> attrs = new HashSet<String>();
+ attrs.add("foo");
+ attrs.add("baz");
+ attrs.add("nil");
+
+ view.setModelKeys(attrs);
+ Map<String, Object> model = new HashMap<String, Object>();
+ model.put("foo", "foo");
+ model.put("bar", "bar");
+ model.put("baz", "baz");
+
+ view.render(model, request, response);
+
+ String result = response.getContentAsString();
+ assertTrue(result.length() > 0);
+ assertTrue(result.contains("\"foo\":\"foo\""));
+ assertTrue(result.contains("\"baz\":\"baz\""));
+
+ validateResult();
+ }
+
+ @Test
+ public void filterSingleKeyModel() throws Exception {
+ view.setExtractValueFromSingleKeyModel(true);
+
+ Map<String, Object> model = new HashMap<String, Object>();
+ TestBeanSimple bean = new TestBeanSimple();
+ model.put("foo", bean);
+
+ Object actual = view.filterModel(model);
+
+ assertSame(bean, actual);
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Test
+ public void filterTwoKeyModel() throws Exception {
+ view.setExtractValueFromSingleKeyModel(true);
+
+ Map<String, Object> model = new HashMap<String, Object>();
+ TestBeanSimple bean1 = new TestBeanSimple();
+ TestBeanSimple bean2 = new TestBeanSimple();
+ model.put("foo1", bean1);
+ model.put("foo2", bean2);
+
+ Object actual = view.filterModel(model);
+
+ assertTrue(actual instanceof Map);
+ assertSame(bean1, ((Map) actual).get("foo1"));
+ assertSame(bean2, ((Map) actual).get("foo2"));
+ }
+
+ private void validateResult() throws Exception {
+ Object jsResult =
+ jsContext.evaluateString(jsScope, "(" + response.getContentAsString() + ")", "JSON Stream", 1, null);
+ assertNotNull("Json Result did not eval as valid JavaScript", jsResult);
+ }
+
+
+ public static class TestBeanSimple {
+
+ private String value = "foo";
+
+ private boolean test = false;
+
+ private long number = 42;
+
+ private TestChildBean child = new TestChildBean();
+
+ public String getValue() {
+ return value;
+ }
+
+ public boolean getTest() {
+ return test;
+ }
+
+ public long getNumber() {
+ return number;
+ }
+
+ public Date getNow() {
+ return new Date();
+ }
+
+ public TestChildBean getChild() {
+ return child;
+ }
+ }
+
+ @JsonSerialize(using=TestBeanSimpleSerializer.class)
+ public static class TestBeanSimpleAnnotated extends TestBeanSimple {
+
+ }
+
+ public static class TestChildBean {
+
+ private String value = "bar";
+
+ private String baz = null;
+
+ private TestBeanSimple parent = null;
+
+ public String getValue() {
+ return value;
+ }
+
+ public String getBaz() {
+ return baz;
+ }
+
+ public TestBeanSimple getParent() {
+ return parent;
+ }
+
+ public void setParent(TestBeanSimple parent) {
+ this.parent = parent;
+ }
+ }
+
+ public static class TestBeanSimpleSerializer extends JsonSerializer<Object> {
+
+ @Override
+ public void serialize(Object value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
+ jgen.writeStartObject();
+ jgen.writeFieldName("testBeanSimple");
+ jgen.writeString("custom");
+ jgen.writeEndObject();
+ }
+ }
+
+ public static class DelegatingSerializerFactory extends BasicSerializerFactory {
+
+ private SerializerFactory beanSerializer = BeanSerializerFactory.instance;
+
+ protected DelegatingSerializerFactory(SerializerFactoryConfig config) {
+ super(config);
+ }
+
+ @Override
+ public JsonSerializer<Object> createSerializer(SerializerProvider prov, JavaType type, BeanProperty property) throws JsonMappingException {
+ if (type.getRawClass() == TestBeanSimple.class) {
+ return new TestBeanSimpleSerializer();
+ }
+ else {
+ return beanSerializer.createSerializer(prov, type, property);
+ }
+ }
+
+ @Override
+ public SerializerFactory withConfig(SerializerFactoryConfig config) {
+ return null;
+ }
+
+ @Override
+ protected Iterable<Serializers> customSerializers() {
+ return null;
+ }
+ }
+} | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | spring-webmvc/src/test/java/org/springframework/web/servlet/view/json/MappingJacksonJsonViewTest.java | @@ -38,6 +38,7 @@
import org.codehaus.jackson.map.SerializerProvider;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import org.codehaus.jackson.map.ser.BeanSerializerFactory;
+
import org.junit.Before;
import org.junit.Test;
import org.mozilla.javascript.Context;
@@ -213,10 +214,10 @@ public void filterSingleKeyModel() throws Exception {
model.put("foo", bean);
Object actual = view.filterModel(model);
-
+
assertSame(bean, actual);
}
-
+
@SuppressWarnings("rawtypes")
@Test
public void filterTwoKeyModel() throws Exception { | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | src/dist/changelog.txt | @@ -13,6 +13,7 @@ Changes in version 3.2 M1
* fix case-sensitivity issue with some containers on access to 'Content-Disposition' header
* add Servlet 3.0 based async support
* fix issue with encoded params in UriComponentsBuilder
+* add Jackson 2 HttpMessageConverter and View types
Changes in version 3.1.1 (2012-02-16)
------------------------------------- | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | src/reference/docbook/mvc.xml | @@ -2892,7 +2892,7 @@ public String upload(...) {
</property>
<property name="defaultViews">
<list>
- <bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" />
+ <bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView" />
</list>
</property>
</bean>
@@ -2924,7 +2924,7 @@ public String upload(...) {
the <classname>SampleContentAtomView</classname> if the view name
returned is <classname>content</classname>. If the request is made with
the file extension <literal>.json</literal>, the
- <classname>MappingJacksonJsonView</classname> instance from the
+ <classname>MappingJackson2JsonView</classname>instance from the
<literal>DefaultViews</literal> list will be selected regardless of the
view name. Alternatively, client requests can be made without a file
extension but with the <literal>Accept</literal> header set to the
@@ -3588,7 +3588,7 @@ public String onSubmit(<emphasis role="bold">@RequestPart("meta-data") MetaData
However, the <literal>@RequestPart("meta-data") MetaData</literal>
method argument in this case is read as JSON content based on its
<literal>'Content-Type'</literal> header and converted with the help of
- the <classname>MappingJacksonHttpMessageConverter</classname>.</para>
+ the <classname>MappingJackson2HttpMessageConverter</classname>.</para>
</section>
</section>
@@ -4256,9 +4256,10 @@ public class WebConfig {
</listitem>
<listitem>
- <para><classname>MappingJacksonHttpMessageConverter</classname>
- converts to/from JSON — added if Jackson is present on the
- classpath.</para>
+ <para><classname>MappingJackson2HttpMessageConverter</classname>
+ (or <classname>MappingJacksonHttpMessageConverter</classname>)
+ converts to/from JSON — added if Jackson 2 (or Jackson) is present
+ on the classpath.</para>
</listitem>
<listitem> | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | src/reference/docbook/remoting.xml | @@ -1363,7 +1363,7 @@ if (HttpStatus.SC_CREATED == post.getStatusCode()) {
these defaults using the <methodname>messageConverters()</methodname> bean
property as would be required if using the
<classname>MarshallingHttpMessageConverter</classname> or
- <classname>MappingJacksonHttpMessageConverter</classname>.</para>
+ <classname>MappingJackson2HttpMessageConverter</classname>.</para>
<para>Each method takes URI template arguments in two forms, either as a
<literal>String</literal> variable length argument or a
@@ -1608,7 +1608,7 @@ String body = response.getBody();</programlisting>
</section>
<section id="rest-mapping-json-converter">
- <title>MappingJacksonHttpMessageConverter</title>
+ <title>MappingJackson2HttpMessageConverter (or MappingJacksonHttpMessageConverter with Jackson 1.x)</title>
<para>An <interfacename>HttpMessageConverter</interfacename>
implementation that can read and write JSON using Jackson's | true |
Other | spring-projects | spring-framework | e63ca04fdb1e01689d0d5c38ffae5991bde2ebd2.json | Add Jackson 2 HttpMessageConverter and View
Jackson 2 uses completely new package names and new maven artifact ids.
This change adds Jackson 2 as an optional dependency and also provides
MappingJackson2HttpMessageConverter and MappingJackson2JsonView for use
with the new version.
The MVC namespace and the MVC Java config detect and use
MappingJackson2HttpMessageConverter if Jackson 2 is present.
Otherwise if Jackson 1.x is present,
then MappingJacksonHttpMessageConverter is used.
Issue: SPR-9302 | src/reference/docbook/view.xml | @@ -2626,7 +2626,9 @@ simpleReport.reportDataKey=myBeanData</programlisting>
<section id="view-json-mapping">
<title>JSON Mapping View</title>
- <para>The <classname>MappingJacksonJsonView</classname> uses the Jackson
+ <para>The <classname>MappingJackson2JsonView</classname>
+ (or <classname>MappingJacksonJsonView</classname> depending on the
+ the Jackson version you have) uses the Jackson
library's <classname>ObjectMapper</classname> to render the response content
as JSON. By default, the entire contents of the model map (with the exception
of framework-specific classes) will be encoded as JSON. For cases where the | true |
Other | spring-projects | spring-framework | 7cdfaf3e0d9e1add3a326db7527a37905edd5e6e.json | Convert SpEL plus operands using reg'd converters
Prior to this commit, SpEL's OpPlus ('+' operator) would convert its
left and right operands to String directly via #toString calls.
This change ensures that operand values are delegated to any registered
converters, allowing for customization of the stringified output.
Note that the OpPlus constructor now throws IllegalArgumentException if
zero operands are supplied.
Issue: SPR-8308 | spring-expression/src/main/java/org/springframework/expression/spel/ast/OpPlus.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2009 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,10 +16,13 @@
package org.springframework.expression.spel.ast;
+import org.springframework.core.convert.TypeDescriptor;
import org.springframework.expression.EvaluationException;
import org.springframework.expression.Operation;
+import org.springframework.expression.TypeConverter;
import org.springframework.expression.TypedValue;
import org.springframework.expression.spel.ExpressionState;
+import org.springframework.util.Assert;
/**
* The plus operator will:
@@ -31,14 +34,16 @@
* </ul>
* It can be used as a unary operator for numbers (double/long/int). The standard promotions are performed
* when the operand types vary (double+int=double). For other options it defers to the registered overloader.
- *
+ *
* @author Andy Clement
+ * @author Ivo Smid
* @since 3.0
*/
public class OpPlus extends Operator {
public OpPlus(int pos, SpelNodeImpl... operands) {
super("+", pos, operands);
+ Assert.notEmpty(operands);
}
@Override
@@ -48,19 +53,21 @@ public TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep
if (rightOp == null) { // If only one operand, then this is unary plus
Object operandOne = leftOp.getValueInternal(state).getValue();
if (operandOne instanceof Number) {
- if (operandOne instanceof Double) {
- return new TypedValue(((Double) operandOne).doubleValue());
- } else if (operandOne instanceof Long) {
- return new TypedValue(((Long) operandOne).longValue());
+ if (operandOne instanceof Double || operandOne instanceof Long) {
+ return new TypedValue(operandOne);
} else {
- return new TypedValue(((Integer) operandOne).intValue());
+ return new TypedValue(((Number) operandOne).intValue());
}
}
return state.operate(Operation.ADD, operandOne, null);
}
else {
- Object operandOne = leftOp.getValueInternal(state).getValue();
- Object operandTwo = rightOp.getValueInternal(state).getValue();
+ final TypedValue operandOneValue = leftOp.getValueInternal(state);
+ final Object operandOne = operandOneValue.getValue();
+
+ final TypedValue operandTwoValue = rightOp.getValueInternal(state);
+ final Object operandTwo = operandTwoValue.getValue();
+
if (operandOne instanceof Number && operandTwo instanceof Number) {
Number op1 = (Number) operandOne;
Number op2 = (Number) operandTwo;
@@ -74,13 +81,14 @@ public TypedValue getValueInternal(ExpressionState state) throws EvaluationExcep
} else if (operandOne instanceof String && operandTwo instanceof String) {
return new TypedValue(new StringBuilder((String) operandOne).append((String) operandTwo).toString());
} else if (operandOne instanceof String) {
- StringBuilder result = new StringBuilder((String)operandOne);
- result.append((operandTwo==null?"null":operandTwo.toString()));
- return new TypedValue(result.toString());
+ StringBuilder result = new StringBuilder((String) operandOne);
+ result.append((operandTwo == null ? "null" : convertTypedValueToString(operandTwoValue, state)));
+ return new TypedValue(result.toString());
} else if (operandTwo instanceof String) {
- StringBuilder result = new StringBuilder((operandOne==null?"null":operandOne.toString()));
- result.append((String)operandTwo);
- return new TypedValue(result.toString());
+ StringBuilder result = new StringBuilder((operandOne == null ? "null" : convertTypedValueToString(
+ operandOneValue, state)));
+ result.append((String) operandTwo);
+ return new TypedValue(result.toString());
}
return state.operate(Operation.ADD, operandOne, operandTwo);
}
@@ -94,10 +102,32 @@ public String toStringAST() {
return super.toStringAST();
}
+ @Override
public SpelNodeImpl getRightOperand() {
- if (children.length<2) {return null;}
+ if (children.length < 2) {
+ return null;
+ }
return children[1];
}
+ /**
+ * Convert operand value to string using registered converter or using
+ * {@code toString} method.
+ *
+ * @param value typed value to be converted
+ * @param state expression state
+ * @return {@code TypedValue} instance converted to {@code String}
+ */
+ private static String convertTypedValueToString(TypedValue value, ExpressionState state) {
+ final TypeConverter typeConverter = state.getEvaluationContext().getTypeConverter();
+ final TypeDescriptor typeDescriptor = TypeDescriptor.valueOf(String.class);
+
+ if (typeConverter.canConvert(value.getTypeDescriptor(), typeDescriptor)) {
+ final Object obj = typeConverter.convertValue(value.getValue(), value.getTypeDescriptor(), typeDescriptor);
+ return String.valueOf(obj);
+ } else {
+ return String.valueOf(value.getValue());
+ }
+ }
} | true |
Other | spring-projects | spring-framework | 7cdfaf3e0d9e1add3a326db7527a37905edd5e6e.json | Convert SpEL plus operands using reg'd converters
Prior to this commit, SpEL's OpPlus ('+' operator) would convert its
left and right operands to String directly via #toString calls.
This change ensures that operand values are delegated to any registered
converters, allowing for customization of the stringified output.
Note that the OpPlus constructor now throws IllegalArgumentException if
zero operands are supplied.
Issue: SPR-8308 | spring-expression/src/test/java/org/springframework/expression/spel/ast/OpPlusTests.java | @@ -0,0 +1,226 @@
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.expression.spel.ast;
+
+import java.sql.Time;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+
+import org.junit.Test;
+
+import org.springframework.core.convert.converter.Converter;
+import org.springframework.core.convert.support.GenericConversionService;
+import org.springframework.expression.TypedValue;
+import org.springframework.expression.spel.ExpressionState;
+import org.springframework.expression.spel.SpelEvaluationException;
+import org.springframework.expression.spel.support.StandardEvaluationContext;
+import org.springframework.expression.spel.support.StandardTypeConverter;
+
+import static org.junit.Assert.*;
+
+/**
+ * Unit tests for SpEL's plus operator.
+ *
+ * @author Ivo Smid
+ * @author Chris Beams
+ * @since 3.2
+ * @see OpPlus
+ */
+public class OpPlusTests {
+
+ @Test(expected = IllegalArgumentException.class)
+ public void test_emptyOperands() {
+ new OpPlus(-1);
+ }
+
+ @Test(expected = SpelEvaluationException.class)
+ public void test_unaryPlusWithStringLiteral() {
+ ExpressionState expressionState = new ExpressionState(new StandardEvaluationContext());
+
+ StringLiteral str = new StringLiteral("word", -1, "word");
+
+ OpPlus o = new OpPlus(-1, str);
+ o.getValueInternal(expressionState);
+ }
+
+ @Test
+ public void test_unaryPlusWithNumberOperand() {
+ ExpressionState expressionState = new ExpressionState(new StandardEvaluationContext());
+
+ {
+ RealLiteral realLiteral = new RealLiteral("123.00", -1, 123.0);
+ OpPlus o = new OpPlus(-1, realLiteral);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(Double.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(Double.class, value.getTypeDescriptor().getType());
+ assertEquals(realLiteral.getLiteralValue().getValue(), value.getValue());
+ }
+
+ {
+ IntLiteral intLiteral = new IntLiteral("123", -1, 123);
+ OpPlus o = new OpPlus(-1, intLiteral);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(Integer.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(Integer.class, value.getTypeDescriptor().getType());
+ assertEquals(intLiteral.getLiteralValue().getValue(), value.getValue());
+ }
+
+ {
+ LongLiteral longLiteral = new LongLiteral("123", -1, 123L);
+ OpPlus o = new OpPlus(-1, longLiteral);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(Long.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(Long.class, value.getTypeDescriptor().getType());
+ assertEquals(longLiteral.getLiteralValue().getValue(), value.getValue());
+ }
+ }
+
+ @Test
+ public void test_binaryPlusWithNumberOperands() {
+ ExpressionState expressionState = new ExpressionState(new StandardEvaluationContext());
+
+ {
+ RealLiteral n1 = new RealLiteral("123.00", -1, 123.0);
+ RealLiteral n2 = new RealLiteral("456.00", -1, 456.0);
+ OpPlus o = new OpPlus(-1, n1, n2);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(Double.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(Double.class, value.getTypeDescriptor().getType());
+ assertEquals(Double.valueOf(123.0 + 456.0), value.getValue());
+ }
+
+ {
+ LongLiteral n1 = new LongLiteral("123", -1, 123L);
+ LongLiteral n2 = new LongLiteral("456", -1, 456L);
+ OpPlus o = new OpPlus(-1, n1, n2);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(Long.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(Long.class, value.getTypeDescriptor().getType());
+ assertEquals(Long.valueOf(123L + 456L), value.getValue());
+ }
+
+ {
+ IntLiteral n1 = new IntLiteral("123", -1, 123);
+ IntLiteral n2 = new IntLiteral("456", -1, 456);
+ OpPlus o = new OpPlus(-1, n1, n2);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(Integer.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(Integer.class, value.getTypeDescriptor().getType());
+ assertEquals(Integer.valueOf(123 + 456), value.getValue());
+ }
+ }
+
+ @Test
+ public void test_binaryPlusWithStringOperands() {
+ ExpressionState expressionState = new ExpressionState(new StandardEvaluationContext());
+
+ StringLiteral n1 = new StringLiteral("\"foo\"", -1, "\"foo\"");
+ StringLiteral n2 = new StringLiteral("\"bar\"", -1, "\"bar\"");
+ OpPlus o = new OpPlus(-1, n1, n2);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(String.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(String.class, value.getTypeDescriptor().getType());
+ assertEquals("foobar", value.getValue());
+ }
+
+ @Test
+ public void test_binaryPlusWithLeftStringOperand() {
+ ExpressionState expressionState = new ExpressionState(new StandardEvaluationContext());
+
+ StringLiteral n1 = new StringLiteral("\"number is \"", -1, "\"number is \"");
+ LongLiteral n2 = new LongLiteral("123", -1, 123);
+ OpPlus o = new OpPlus(-1, n1, n2);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(String.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(String.class, value.getTypeDescriptor().getType());
+ assertEquals("number is 123", value.getValue());
+ }
+
+ @Test
+ public void test_binaryPlusWithRightStringOperand() {
+ ExpressionState expressionState = new ExpressionState(new StandardEvaluationContext());
+
+ LongLiteral n1 = new LongLiteral("123", -1, 123);
+ StringLiteral n2 = new StringLiteral("\" is a number\"", -1, "\" is a number\"");
+ OpPlus o = new OpPlus(-1, n1, n2);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(String.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(String.class, value.getTypeDescriptor().getType());
+ assertEquals("123 is a number", value.getValue());
+ }
+
+ @Test
+ public void test_binaryPlusWithTime_ToString() {
+
+ ExpressionState expressionState = new ExpressionState(new StandardEvaluationContext());
+
+ Time time = new Time(new Date().getTime());
+
+ VariableReference var = new VariableReference("timeVar", -1);
+ var.setValue(expressionState, time);
+
+ StringLiteral n2 = new StringLiteral("\" is now\"", -1, "\" is now\"");
+ OpPlus o = new OpPlus(-1, var, n2);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(String.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(String.class, value.getTypeDescriptor().getType());
+ assertEquals(time + " is now", value.getValue());
+ }
+
+ @Test
+ public void test_binaryPlusWithTimeConverted() {
+
+ final SimpleDateFormat format = new SimpleDateFormat("hh :--: mm :--: ss", Locale.ENGLISH);
+
+ GenericConversionService conversionService = new GenericConversionService();
+ conversionService.addConverter(new Converter<Time, String>() {
+ public String convert(Time source) {
+ return format.format(source);
+ }
+ });
+
+ StandardEvaluationContext evaluationContextConverter = new StandardEvaluationContext();
+ evaluationContextConverter.setTypeConverter(new StandardTypeConverter(conversionService));
+
+ ExpressionState expressionState = new ExpressionState(evaluationContextConverter);
+
+ Time time = new Time(new Date().getTime());
+
+ VariableReference var = new VariableReference("timeVar", -1);
+ var.setValue(expressionState, time);
+
+ StringLiteral n2 = new StringLiteral("\" is now\"", -1, "\" is now\"");
+ OpPlus o = new OpPlus(-1, var, n2);
+ TypedValue value = o.getValueInternal(expressionState);
+
+ assertEquals(String.class, value.getTypeDescriptor().getObjectType());
+ assertEquals(String.class, value.getTypeDescriptor().getType());
+ assertEquals(format.format(time) + " is now", value.getValue());
+ }
+
+} | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-aop/src/main/java/org/springframework/aop/interceptor/AsyncExecutionInterceptor.java | @@ -32,7 +32,7 @@
/**
* AOP Alliance <code>MethodInterceptor</code> that processes method invocations
* asynchronously, using a given {@link org.springframework.core.task.AsyncTaskExecutor}.
- * Typically used with the {@link org.springframework.context.task.Async} annotation.
+ * Typically used with the {@link org.springframework.scheduling.annotation.Async} annotation.
*
* <p>In terms of target method signatures, any parameter types are supported.
* However, the return type is constrained to either <code>void</code> or | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-aop/src/main/java/org/springframework/aop/target/AbstractPrototypeBasedTargetSource.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,8 +28,9 @@
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
/**
- * Base class for dynamic {@link TargetSource} implementations that create new prototype
- * bean instances to support a pooling or new-instance-per-invocation strategy.
+ * Base class for dynamic {@link org.springframework.aop.TargetSource} implementations
+ * that create new prototype bean instances to support a pooling or
+ * new-instance-per-invocation strategy.
*
* <p>Such TargetSources must run in a {@link BeanFactory}, as it needs to
* call the <code>getBean</code> method to create a new prototype instance. | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-aspects/src/main/java/org/springframework/scheduling/aspectj/AspectJAsyncConfiguration.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@
* @author Chris Beams
* @since 3.1
* @see EnableAsync
- * @see AsyncConfigurationSelector
+ * @see org.springframework.scheduling.annotation.AsyncConfigurationSelector
*/
@Configuration
public class AspectJAsyncConfiguration extends AbstractAsyncConfiguration { | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-beans/src/main/java/org/springframework/beans/factory/annotation/Autowired.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@
* a special case of such a general config method. Such config methods
* do not have to be public.
*
- * <p>In the case of multiple argument methods, the 'required' parameter is
+ * <p>In the case of multiple argument methods, the 'required' parameter is
* applicable for all arguments.
*
* <p>In case of a {@link java.util.Collection} or {@link java.util.Map}
@@ -52,8 +52,9 @@
* BeanPostProcessor} which in turn means that you <em>cannot</em>
* use {@code @Autowired} to inject references into
* {@link org.springframework.beans.factory.config.BeanPostProcessor
- * BeanPostProcessor} or {@link BeanFactoryPostProcessor} types. Please
- * consult the javadoc for the {@link AutowiredAnnotationBeanPostProcessor}
+ * BeanPostProcessor} or
+ * {@link org.springframework.beans.factory.config.BeanFactoryPostProcessor BeanFactoryPostProcessor}
+ * types. Please consult the javadoc for the {@link AutowiredAnnotationBeanPostProcessor}
* class (which, by default, checks for the presence of this annotation).
*
* @author Juergen Hoeller | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-beans/src/main/java/org/springframework/beans/factory/annotation/Value.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,8 +37,9 @@
* BeanPostProcessor} which in turn means that you <em>cannot</em> use
* {@code @Value} within
* {@link org.springframework.beans.factory.config.BeanPostProcessor
- * BeanPostProcessor} or {@link BeanFactoryPostProcessor} types. Please
- * consult the javadoc for the {@link AutowiredAnnotationBeanPostProcessor}
+ * BeanPostProcessor} or
+ * {@link org.springframework.beans.factory.config.BeanFactoryPostProcessor BeanFactoryPostProcessor}
+ * types. Please consult the javadoc for the {@link AutowiredAnnotationBeanPostProcessor}
* class (which, by default, checks for the presence of this annotation).
*
* @author Juergen Hoeller | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,8 +36,8 @@
*
*<pre class="code">{@code
*<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"/>
- * <property name="driverClassName" value="}${driver}{@code"/>
- * <property name="url" value="jdbc:}${dbname}{@code"/>
+ * <property name="driverClassName" value="}${driver}{@code "/>
+ * <property name="url" value="jdbc:}${dbname}{@code "/>
*</bean>
*}</pre>
*
@@ -76,7 +76,7 @@
* <p>Example XML property with default value:
*
*<pre class="code">{@code
- * <property name="url" value="jdbc:}${dbname:defaultdb}{@code"/>
+ * <property name="url" value="jdbc:}${dbname:defaultdb}{@code "/>
*}</pre>
*
* @author Chris Beams | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-beans/src/main/java/org/springframework/beans/factory/xml/BeanDefinitionParserDelegate.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -353,7 +353,7 @@ public void initDefaults(Element root) {
* <literal>parentDefaults</literal> in case the defaults are not explicitly set
* locally.
* @param defaults the defaults to populate
- * @param defaults the parent BeanDefinitionParserDelegate (if any) defaults to fall back to
+ * @param parentDefaults the parent BeanDefinitionParserDelegate (if any) defaults to fall back to
* @param root the root element of the current bean definition document (or nested beans element)
*/
protected void populateDefaults(DocumentDefaultsDefinition defaults, DocumentDefaultsDefinition parentDefaults, Element root) { | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-beans/src/main/java/org/springframework/beans/support/ResourceEditorRegistrar.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@
import org.springframework.beans.propertyeditors.InputStreamEditor;
import org.springframework.beans.propertyeditors.URIEditor;
import org.springframework.beans.propertyeditors.URLEditor;
-import org.springframework.core.env.Environment;
import org.springframework.core.env.PropertyResolver;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.core.io.ContextResource;
@@ -71,7 +70,7 @@ public class ResourceEditorRegistrar implements PropertyEditorRegistrar {
* @see org.springframework.core.io.support.ResourcePatternResolver
* @see org.springframework.context.ApplicationContext
* @deprecated as of Spring 3.1 in favor of
- * {@link #ResourceEditorRegistrar(ResourceLoader, Environment)}
+ * {@link #ResourceEditorRegistrar(ResourceLoader, PropertyResolver)}
*/
@Deprecated
public ResourceEditorRegistrar(ResourceLoader resourceLoader) { | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/CronTriggerFactoryBean.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,9 +56,7 @@
* @since 3.1
* @see #setName
* @see #setGroup
- * @see #setStartTime
- * @see #setJobName
- * @see #setJobGroup
+ * @see #setStartDelay
* @see #setJobDetail
* @see org.springframework.scheduling.quartz.SchedulerFactoryBean#setTriggers
* @see org.springframework.scheduling.quartz.SchedulerFactoryBean#setJobDetails | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context-support/src/main/java/org/springframework/scheduling/quartz/SimpleTriggerFactoryBean.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,9 +56,7 @@
* @since 3.1
* @see #setName
* @see #setGroup
- * @see #setStartTime
- * @see #setJobName
- * @see #setJobGroup
+ * @see #setStartDelay
* @see #setJobDetail
* @see org.springframework.scheduling.quartz.SchedulerFactoryBean#setTriggers
* @see org.springframework.scheduling.quartz.SchedulerFactoryBean#setJobDetails | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/cache/annotation/CacheAnnotationParser.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@ public interface CacheAnnotationParser {
* @param ae the annotated method or class
* @return CacheOperation the configured caching operation,
* or {@code null} if none was found
- * @see AnnotationCacheOperationSource#determineCacheOperation
+ * @see AnnotationCacheOperationSource#determineCacheOperations(AnnotatedElement)
*/
Collection<CacheOperation> parseCacheAnnotations(AnnotatedElement ae);
} | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/cache/annotation/CachingConfigurationSelector.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@
* @since 3.1
* @see EnableCaching
* @see ProxyCachingConfiguration
- * @see AnnotationConfigUtils.CACHE_ASPECT_CONFIGURATION_CLASS_NAME
+ * @see AnnotationConfigUtils#CACHE_ASPECT_CONFIGURATION_CLASS_NAME
*/
public class CachingConfigurationSelector extends AdviceModeImportSelector<EnableCaching> {
| true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/cache/annotation/EnableCaching.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -163,7 +163,7 @@
/**
* Indicate how caching advice should be applied. The default is
- * {@link AdviceMode.PROXY}.
+ * {@link AdviceMode#PROXY}.
* @see AdviceMode
*/
AdviceMode mode() default AdviceMode.PROXY; | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/cache/concurrent/ConcurrentMapCache.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -115,7 +115,7 @@ public void clear() {
/**
* Convert the given value from the internal store to a user value
* returned from the get method (adapting <code>null</code>).
- * @param userValue the store value
+ * @param storeValue the store value
* @return the value to return to the user
*/
protected Object fromStoreValue(Object storeValue) { | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/cache/ehcache/EhCacheCacheManager.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,8 +39,8 @@ public class EhCacheCacheManager extends AbstractCacheManager {
/**
- * Returns the backing Ehcache {@link net.sf.ehcache.CacheManager}.
- * @return
+ * Returns the backing EhCache {@link net.sf.ehcache.CacheManager}.
+ * @return the backing EhCache {@link net.sf.ehcache.CacheManager}.
*/
public net.sf.ehcache.CacheManager getCacheManager() {
return cacheManager; | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/cache/interceptor/BeanFactoryCacheOperationSourceAdvisor.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -44,7 +44,6 @@ protected CacheOperationSource getCacheOperationSource() {
* Set the cache operation attribute source which is used to find cache
* attributes. This should usually be identical to the source reference
* set on the cache interceptor itself.
- * @see CacheInterceptor#setCacheAttributeSource
*/
public void setCacheOperationSource(CacheOperationSource cacheOperationSource) {
this.cacheOperationSource = cacheOperationSource; | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/cache/interceptor/CacheProxyFactoryBean.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2010-2011 the original author or authors.
+ * Copyright 2010-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
* Proxy factory bean for simplified declarative caching handling.
* This is a convenient alternative to a standard AOP
* {@link org.springframework.aop.framework.ProxyFactoryBean}
- * with a separate {@link CachingInterceptor} definition.
+ * with a separate {@link CacheInterceptor} definition.
*
* <p>This class is designed to facilitate declarative cache demarcation: namely, wrapping
* a singleton target object with a caching proxy, proxying all the interfaces that the
@@ -36,7 +36,7 @@
*
* @author Costin Leau
* @see org.springframework.aop.framework.ProxyFactoryBean
- * @see CachingInterceptor
+ * @see CacheInterceptor
*/
@SuppressWarnings("serial")
public class CacheProxyFactoryBean extends AbstractSingletonProxyFactoryBean { | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/cache/interceptor/NameMatchCacheOperationSource.java | @@ -50,7 +50,6 @@ public class NameMatchCacheOperationSource implements CacheOperationSource, Seri
* (e.g. "myMethod") and CacheOperation instances
* (or Strings to be converted to CacheOperation instances).
* @see CacheOperation
- * @see CacheOperationEditor
*/
public void setNameMap(Map<String, Collection<CacheOperation>> nameMap) {
for (Map.Entry<String, Collection<CacheOperation>> entry : nameMap.entrySet()) { | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/context/annotation/Configuration.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
import org.springframework.stereotype.Component;
/**
- * Indicates that a class declares one or more @{@link Bean} methods and may be processed
+ * Indicates that a class declares one or more {@link Bean @Bean} methods and may be processed
* by the Spring container to generate bean definitions and service requests for those
* beans at runtime, for example:
* <pre class="code">
@@ -76,23 +76,23 @@
* post processors that facilitate handling {@code @Configuration} classes.
*
* <h3>Via component scanning</h3>
- * <p>{@code @Configuration} is meta-annotated with @{@link Component}, therefore
+ * <p>{@code @Configuration} is meta-annotated with {@link Component @Component}, therefore
* {@code @Configuration} classes are candidates for component scanning (typically using
* Spring XML's {@code <context:component-scan/>} element) and therefore may also take
- * advantage of @{@link Autowired}/@{@link Inject} at the field and method level (but not
- * at the constructor level).
+ * advantage of {@link Autowired @Autowired}/{@link javax.inject.Inject @Inject}
+ * at the field and method level (but not at the constructor level).
* <p>{@code @Configuration} classes may not only be bootstrapped using
* component scanning, but may also themselves <em>configure</em> component scanning using
- * the @{@link ComponentScan} annotation:
+ * the {@link ComponentScan @ComponentScan} annotation:
* <pre class="code">
* @Configuration
* @ComponentScan("com.acme.app.services")
* public class AppConfig {
* // various @Bean definitions ...
* }</pre>
*
- * See @{@link ComponentScan} Javadoc for details.
- *
+ * See {@link ComponentScan @ComponentScan} Javadoc for details.
+ *
*
* <h2>Working with externalized values</h2>
* <h3>Using the {@code Environment} API</h3>
@@ -115,7 +115,8 @@
*
* Properties resolved through the {@code Environment} reside in one or more "property
* source" objects, and {@code @Configuration} classes may contribute property sources to
- * the {@code Environment} object using the @{@link PropertySources} annotation:
+ * the {@code Environment} object using
+ * the {@link org.springframework.core.env.PropertySources @PropertySources} annotation:
* <pre class="code">
* @Configuration
* @PropertySource("classpath:/com/acme/app.properties")
@@ -129,11 +130,11 @@
* }</pre>
*
* See {@link org.springframework.core.env.Environment Environment}
- * and @{@link PropertySource} Javadoc for further details.
- *
+ * and {@link PropertySource @PropertySource} Javadoc for further details.
+ *
* <h3>Using the {@code @Value} annotation</h3>
* Externalized values may be 'wired into' {@code @Configuration} classes using
- * the @{@link Value} annotation:
+ * the {@link Value @Value} annotation:
* <pre class="code">
* @Configuration
* @PropertySource("classpath:/com/acme/app.properties")
@@ -151,13 +152,13 @@
* PropertySourcesPlaceholderConfigurer}, usually enabled via XML with
* {@code <context:property-placeholder/>}. See the section below on composing
* {@code @Configuration} classes with Spring XML using {@code @ImportResource},
- * see @{@link Value} Javadoc, and see @{@link Bean} Javadoc for details on working with
+ * see {@link Value @Value} Javadoc, and see {@link Bean @Bean} Javadoc for details on working with
* {@code BeanFactoryPostProcessor} types such as
* {@code PropertySourcesPlaceholderConfigurer}.
*
* <h2>Composing {@code @Configuration} classes</h2>
* <h3>With the {@code @Import} annotation</h3>
- * <p>{@code @Configuration} classes may be composed using the @{@link Import} annotation,
+ * <p>{@code @Configuration} classes may be composed using the {@link Import @Import} annotation,
* not unlike the way that {@code <import>} works in Spring XML. Because
* {@code @Configuration} objects are managed as Spring beans within the container,
* imported configurations may be injected using {@code @Autowired} or {@code @Inject}:
@@ -189,7 +190,7 @@
* new AnnotationConfigApplicationContext(AppConfig.class);</pre>
*
* <h3>With the {@code @Profile} annotation</h3>
- * {@code @Configuration} classes may be marked with the @{@link Profile} annotation to
+ * {@code @Configuration} classes may be marked with the {@link Profile @Profile} annotation to
* indicate they should be processed only if a given profile or profiles are
* <em>active</em>:
* <pre class="code">
@@ -211,14 +212,14 @@
* }
* }</pre>
*
- * See @{@link Profile} and {@link org.springframework.core.env.Environment Environment}
+ * See {@link Profile @Profile} and {@link org.springframework.core.env.Environment Environment}
* Javadoc for further details.
*
* <h3>With Spring XML using the {@code @ImportResource} annotation</h3>
* As mentioned above, {@code @Configuration} classes may be declared as regular Spring
* {@code <bean>} definitions within Spring XML files. It is also possible to
* import Spring XML configuration files into {@code @Configuration} classes using
- * the @{@link ImportResource} annotation. Bean definitions imported from XML can be
+ * the {@link ImportResource @ImportResource} annotation. Bean definitions imported from XML can be
* injected using {@code @Autowired} or {@code @Import}:
* <pre class="code">
* @Configuration
@@ -267,7 +268,7 @@
* <h2>Configuring lazy initialization</h2>
* <p>By default, {@code @Bean} methods will be <em>eagerly instantiated</em> at container
* bootstrap time. To avoid this, {@code @Configuration} may be used in conjunction with
- * the @{@link Lazy} annotation to indicate that all {@code @Bean} methods declared within
+ * the {@link Lazy @Lazy} annotation to indicate that all {@code @Bean} methods declared within
* the class are by default lazily initialized. Note that {@code @Lazy} may be used on
* individual {@code @Bean} methods as well.
*
@@ -291,7 +292,7 @@
* }</pre>
*
* See TestContext framework reference documentation for details.
- *
+ *
* <h2>Enabling built-in Spring features using {@code @Enable} annotations</h2>
* Spring features such as asynchronous method execution, scheduled task execution,
* annotation driven transaction management, and even Spring MVC can be enabled and
@@ -309,7 +310,7 @@
* <li>@Configuration classes must be non-final
* <li>@Configuration classes must be non-local (may not be declared within a method)
* <li>@Configuration classes must have a default/no-arg constructor and may not
- * use @{@link Autowired} constructor parameters. Any nested configuration classes
+ * use {@link Autowired @Autowired} constructor parameters. Any nested configuration classes
* must be {@code static}
* </ul>
* | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/context/annotation/EnableLoadTimeWeaving.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -64,13 +64,13 @@
* TomcatInstrumentableClassLoader}).
*
* <p>To customize the weaver used, the {@code @Configuration} class annotated with
- * {@code @EnableLoadTimeWeaving} may also implement the {@link LoadTimeWeaverConfigurer}
+ * {@code @EnableLoadTimeWeaving} may also implement the {@link LoadTimeWeavingConfigurer}
* interface and return a custom {@code LoadTimeWeaver} instance through the
* {@code #getLoadTimeWeaver} method:
* <pre class="code">
* @Configuration
* @EnableLoadTimeWeaving
- * public class AppConfig implements LoadTimeWeaverConfigurer {
+ * public class AppConfig implements LoadTimeWeavingConfigurer {
* @Override
* public LoadTimeWeaver getLoadTimeWeaver() {
* MyLoadTimeWeaver ltw = new MyLoadTimeWeaver(); | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/context/annotation/FilterType.java | @@ -28,8 +28,8 @@
* @author Chris Beams
* @since 2.5
* @see ComponentScan
- * @see ComponentScan.IncludeFilter
- * @see ComponentScan.ExcludeFilter
+ * @see ComponentScan#includeFilters()
+ * @see ComponentScan#excludeFilters()
* @see org.springframework.core.type.filter.TypeFilter
*/
public enum FilterType { | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/context/annotation/Import.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,23 +23,23 @@
import java.lang.annotation.Target;
/**
- * Indicates one or more @{@link Configuration} classes to import.
+ * Indicates one or more {@link Configuration @Configuration} classes to import.
*
* <p>Provides functionality equivalent to the {@code <import/>} element in Spring XML.
* Only supported for classes annotated with {@code @Configuration} or declaring at least
- * one {@link @Bean} method, as well as {@link ImportSelector} and
+ * one {@link Bean @Bean} method, as well as {@link ImportSelector} and
* {@link ImportBeanDefinitionRegistrar} implementations.
*
- * <p>@{@code Bean} definitions declared in imported {@code @Configuration} classes
- * should be accessed by using @{@link Autowired} injection. Either the bean itself can
- * be autowired, or the configuration class instance declaring the bean can be autowired.
- * The latter approach allows for explicit, IDE-friendly navigation between
- * {@code @Configuration} class methods.
+ * <p>{@code @Bean} definitions declared in imported {@code @Configuration} classes
+ * should be accessed by using {@link org.springframework.beans.factory.annotation.Autowired @Autowired}
+ * injection. Either the bean itself can be autowired, or the configuration class instance
+ * declaring the bean can be autowired. The latter approach allows for explicit,
+ * IDE-friendly navigation between {@code @Configuration} class methods.
*
* <p>May be declared at the class level or as a meta-annotation.
*
* <p>If XML or other non-{@code @Configuration} bean definition resources need to be
- * imported, use @{@link ImportResource}
+ * imported, use {@link ImportResource @ImportResource}
*
* @author Chris Beams
* @since 3.0 | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/context/annotation/LoadTimeWeavingConfigurer.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,12 +19,14 @@
import org.springframework.instrument.classloading.LoadTimeWeaver;
/**
- * Interface to be implemented by @{@link org.springframework.context.annotation.Configuration
- * Configuration} classes annotated with @{@link EnableLoadTimeWeaving} that wish to
+ * Interface to be implemented by
+ * {@link org.springframework.context.annotation.Configuration @Configuration}
+ * classes annotated with {@link EnableLoadTimeWeaving @EnableLoadTimeWeaving} that wish to
* customize the {@link LoadTimeWeaver} instance to be used.
*
- * <p>See @{@link EnableAsync} for usage examples and information on how a default
- * {@code LoadTimeWeaver} is selected when this interface is not used.
+ * <p>See {@link org.springframework.scheduling.annotation.EnableAsync @EnableAsync}
+ * for usage examples and information on how a default {@code LoadTimeWeaver}
+ * is selected when this interface is not used.
*
* @author Chris Beams
* @since 3.1 | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java | @@ -506,7 +506,7 @@ protected void prepareRefresh() {
/**
* <p>Replace any stub property sources with actual instances.
* @see org.springframework.core.env.PropertySource.StubPropertySource
- * @see org.springframework.web.context.support.WebApplicationContextUtils#initSerlvetPropertySources
+ * @see org.springframework.web.context.support.WebApplicationContextUtils#initServletPropertySources
*/
protected void initPropertySources() {
// For subclasses: do nothing by default. | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/context/support/PropertySourcesPlaceholderConfigurer.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -108,7 +108,7 @@ public void setEnvironment(Environment environment) {
* <p>Processing occurs by replacing ${...} placeholders in bean definitions by resolving each
* against this configurer's set of {@link PropertySources}, which includes:
* <ul>
- * <li>all {@linkplain Environment#getPropertySources environment property sources}, if an
+ * <li>all {@linkplain org.springframework.core.env.ConfigurableEnvironment#getPropertySources environment property sources}, if an
* {@code Environment} {@linkplain #setEnvironment is present}
* <li>{@linkplain #mergeProperties merged local properties}, if {@linkplain #setLocation any}
* {@linkplain #setLocations have} {@linkplain #setProperties been} | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/format/datetime/joda/JodaTimeFormatterRegistrar.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,7 @@
* @see #setTimeStyle
* @see #setDateTimeStyle
* @see #setUseIsoFormat
- * @see #installJodaTimeFormatting
+ * @see FormatterRegistrar#registerFormatters
*/
public class JodaTimeFormatterRegistrar implements FormatterRegistrar {
| true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/instrument/classloading/glassfish/GlassFishLoadTimeWeaver.java | @@ -23,8 +23,9 @@
import org.springframework.util.ClassUtils;
/**
- * {@link LoadTimeWeaver} implementation for GlassFish's {@link InstrumentableClassLoader}.
- *
+ * {@link LoadTimeWeaver} implementation for GlassFish's
+ * {@link org.glassfish.api.deployment.InstrumentableClassLoader InstrumentableClassLoader}.
+ *
* <p>As of Spring 3.0, GlassFish V3 is supported as well.
*
* @author Costin Leau
@@ -49,7 +50,8 @@ public GlassFishLoadTimeWeaver() {
* Creates a new instance of the <code>GlassFishLoadTimeWeaver</code> class.
* @param classLoader the specific {@link ClassLoader} to use; must not be <code>null</code>
* @throws IllegalArgumentException if the supplied <code>classLoader</code> is <code>null</code>;
- * or if the supplied <code>classLoader</code> is not an {@link InstrumentableClassLoader}
+ * or if the supplied <code>classLoader</code> is not an
+ * {@link org.glassfish.api.deployment.InstrumentableClassLoader InstrumentableClassLoader}
*/
public GlassFishLoadTimeWeaver(ClassLoader classLoader) {
Assert.notNull(classLoader, "ClassLoader must not be null"); | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/jmx/access/MBeanClientInterceptor.java | @@ -526,7 +526,7 @@ private Object invokeOperation(Method method, Object[] args) throws JMException,
* Convert the given result object (from attribute access or operation invocation)
* to the specified target class for returning from the proxy method.
* @param result the result object as returned by the <code>MBeanServer</code>
- * @param targetClass the result type of the proxy method that's been invoked
+ * @param parameter the method parameter of the proxy method that's been invoked
* @return the converted result object, or the passed-in object if no conversion
* is necessary
*/ | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/jmx/export/assembler/AbstractMBeanInfoAssembler.java | @@ -88,7 +88,7 @@ protected void checkManagedBean(Object managedBean) throws IllegalArgumentExcept
* and the plain bean class else.
* @param managedBean the bean instance (might be an AOP proxy)
* @return the bean class to expose
- * @see org.springframework.aop.framework.AopProxyUtils#getTargetClass
+ * @see org.springframework.aop.support.AopUtils#getTargetClass(Object)
*/
protected Class getTargetClass(Object managedBean) {
return AopUtils.getTargetClass(managedBean);
@@ -100,7 +100,7 @@ protected Class getTargetClass(Object managedBean) {
* (for example, checked for annotations).
* @param managedBean the bean instance (might be an AOP proxy)
* @return the bean class to expose
- * @see JmxUtils#getClassToExpose(Object)
+ * @see JmxUtils#getClassToExpose(Object)
*/
protected Class<?> getClassToExpose(Object managedBean) {
return JmxUtils.getClassToExpose(managedBean); | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationAdvisor.java | @@ -45,7 +45,7 @@
*
* @author Juergen Hoeller
* @since 3.0
- * @see PersistenceExceptionTranslationAdvisor
+ * @see org.springframework.dao.annotation.PersistenceExceptionTranslationAdvisor
* @see org.springframework.stereotype.Repository
* @see org.springframework.dao.DataAccessException
* @see org.springframework.dao.support.PersistenceExceptionTranslator
@@ -126,8 +126,8 @@ protected Advice buildAdvice(Executor executor) {
}
/**
- * Calculate a pointcut for the given target class, if any.
- * @param targetClass the class to introspect
+ * Calculate a pointcut for the given async annotation types, if any.
+ * @param asyncAnnotationTypes the async annotation types to introspect
* @return the applicable Pointcut object, or <code>null</code> if none
*/
protected Pointcut buildPointcut(Set<Class<? extends Annotation>> asyncAnnotationTypes) { | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-context/src/main/java/org/springframework/validation/beanvalidation/MethodValidationInterceptor.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,7 +76,7 @@ public MethodValidationInterceptor(ValidatorFactory validatorFactory) {
/**
* Create a new MethodValidationInterceptor using the given JSR-303 Validator.
- * @param validatorFactory the JSR-303 Validator to use
+ * @param validator the JSR-303 Validator to use
*/
public MethodValidationInterceptor(Validator validator) {
this.validator = validator.unwrap(MethodValidator.class); | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-core/src/main/java/org/springframework/core/convert/ConverterNotFoundException.java | @@ -20,7 +20,7 @@
* Thrown when a suitable converter could not be found in a conversion service.
*
* @author Keith Donald
- * @since 3.0
+ * @since 3.0
*/
@SuppressWarnings("serial")
public final class ConverterNotFoundException extends ConversionException {
@@ -34,7 +34,6 @@ public final class ConverterNotFoundException extends ConversionException {
* Creates a new conversion executor not found exception.
* @param sourceType the source type requested to convert from
* @param targetType the target type requested to convert to
- * @param message a descriptive message
*/
public ConverterNotFoundException(TypeDescriptor sourceType, TypeDescriptor targetType) {
super("No converter found capable of converting from type " + sourceType + " to type " + targetType); | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-core/src/main/java/org/springframework/core/convert/TypeDescriptor.java | @@ -74,7 +74,7 @@ public class TypeDescriptor {
/**
* Create a new type descriptor from a {@link MethodParameter}.
- * Use this constructor when a source or target conversion point is a constructor parameter, method parameter, or method return value.
+ * Use this constructor when a source or target conversion point is a constructor parameter, method parameter, or method return value.
* @param methodParameter the method parameter
*/
public TypeDescriptor(MethodParameter methodParameter) {
@@ -204,7 +204,7 @@ public static TypeDescriptor nested(Property property, int nestingLevel) {
* Create a new type descriptor for an object.
* Use this factory method to introspect a source object before asking the conversion system to convert it to some another type.
* If the provided object is null, returns null, else calls {@link #valueOf(Class)} to build a TypeDescriptor from the object's class.
- * @param object the source object
+ * @param source the source object
* @return the type descriptor
*/
public static TypeDescriptor forObject(Object source) {
@@ -287,7 +287,7 @@ public Annotation getAnnotation(Class<? extends Annotation> annotationType) {
/**
* Returns true if an object of this type descriptor can be assigned to the location described by the given type descriptor.
- * For example, valueOf(String.class).isAssignableTo(valueOf(CharSequence.class)) returns true because a String value can be assigned to a CharSequence variable.
+ * For example, valueOf(String.class).isAssignableTo(valueOf(CharSequence.class)) returns true because a String value can be assigned to a CharSequence variable.
* On the other hand, valueOf(Number.class).isAssignableTo(valueOf(Integer.class)) returns false because, while all Integers are Numbers, not all Numbers are Integers.
* <p>
* For arrays, collections, and maps, element and key/value types are checked if declared.
@@ -348,7 +348,7 @@ public TypeDescriptor getElementTypeDescriptor() {
* Narrows the {@link #getElementTypeDescriptor() elementType} property to the class of the provided collection or array element.
* For example, if this describes a java.util.List<java.lang.Number< and the element argument is a java.lang.Integer, the returned TypeDescriptor will be java.lang.Integer.
* If this describes a java.util.List<?> and the element argument is a java.lang.Integer, the returned TypeDescriptor will be java.lang.Integer as well.
- * Annotation and nested type context will be preserved in the narrowed TypeDescriptor that is returned.
+ * Annotation and nested type context will be preserved in the narrowed TypeDescriptor that is returned.
* @param element the collection or array element
* @return a element type descriptor, narrowed to the type of the provided element
* @throws IllegalStateException if this type is not a java.util.Collection or Array type
@@ -383,7 +383,7 @@ public TypeDescriptor getMapKeyTypeDescriptor() {
* Narrows the {@link #getMapKeyTypeDescriptor() mapKeyType} property to the class of the provided map key.
* For example, if this describes a java.util.Map<java.lang.Number, java.lang.String< and the key argument is a java.lang.Integer, the returned TypeDescriptor will be java.lang.Integer.
* If this describes a java.util.Map<?, ?> and the key argument is a java.lang.Integer, the returned TypeDescriptor will be java.lang.Integer as well.
- * Annotation and nested type context will be preserved in the narrowed TypeDescriptor that is returned.
+ * Annotation and nested type context will be preserved in the narrowed TypeDescriptor that is returned.
* @param mapKey the map key
* @return the map key type descriptor
* @throws IllegalStateException if this type is not a java.util.Map.
@@ -409,10 +409,10 @@ public TypeDescriptor getMapValueTypeDescriptor() {
* Narrows the {@link #getMapValueTypeDescriptor() mapValueType} property to the class of the provided map value.
* For example, if this describes a java.util.Map<java.lang.String, java.lang.Number< and the value argument is a java.lang.Integer, the returned TypeDescriptor will be java.lang.Integer.
* If this describes a java.util.Map<?, ?> and the value argument is a java.lang.Integer, the returned TypeDescriptor will be java.lang.Integer as well.
- * Annotation and nested type context will be preserved in the narrowed TypeDescriptor that is returned.
+ * Annotation and nested type context will be preserved in the narrowed TypeDescriptor that is returned.
* @param mapValue the map value
* @return the map value type descriptor
- * @throws IllegalStateException if this type is not a java.util.Map.
+ * @throws IllegalStateException if this type is not a java.util.Map.
*/
public TypeDescriptor getMapValueTypeDescriptor(Object mapValue) {
return narrow(mapValue, getMapValueTypeDescriptor()); | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-core/src/main/java/org/springframework/core/env/AbstractEnvironment.java | @@ -41,9 +41,9 @@
*
* <p>Concrete subclasses differ primarily on which {@link PropertySource} objects they
* add by default. {@code AbstractEnvironment} adds none. Subclasses should contribute
- * property sources through the protected {@link #customizePropertySources()} hook, while
- * clients should customize using {@link ConfigurableEnvironment#getPropertySources()} and
- * working against the {@link MutablePropertySources} API. See
+ * property sources through the protected {@link #customizePropertySources(MutablePropertySources)}
+ * hook, while clients should customize using {@link ConfigurableEnvironment#getPropertySources()}
+ * and working against the {@link MutablePropertySources} API. See
* {@link ConfigurableEnvironment} Javadoc for usage examples.
*
* @author Chris Beams | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-core/src/main/java/org/springframework/core/env/PropertyResolver.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,7 +56,7 @@ public interface PropertyResolver {
* Return the property value associated with the given key, or {@code null}
* if the key cannot be resolved.
* @param key the property name to resolve
- * @param T the expected type of the property value
+ * @param targetType the expected type of the property value
* @see #getRequiredProperty(String, Class)
*/
<T> T getProperty(String key, Class<T> targetType);
@@ -65,11 +65,11 @@ public interface PropertyResolver {
* Return the property value associated with the given key, or
* {@code defaultValue} if the key cannot be resolved.
* @param key the property name to resolve
- * @param T the expected type of the property value
+ * @param targetType the expected type of the property value
* @param defaultValue the default value to return if no value is found
* @see #getRequiredProperty(String, Class)
*/
- <T> T getProperty(String string, Class<T> targetType, T defaultValue);
+ <T> T getProperty(String key, Class<T> targetType, T defaultValue);
/**
* Convert the property value associated with the given key to a {@code Class} | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-core/src/main/java/org/springframework/core/serializer/support/SerializingConverter.java | @@ -24,7 +24,7 @@
import org.springframework.util.Assert;
/**
- * A {@Link Converter} that delegates to a {@link org.springframework.core.serializer.Serializer}
+ * A {@link Converter} that delegates to a {@link org.springframework.core.serializer.Serializer}
* to convert an object to a byte array.
*
* @author Gary Russell | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-core/src/main/java/org/springframework/core/task/support/ExecutorServiceAdapter.java | @@ -49,7 +49,7 @@ public class ExecutorServiceAdapter extends AbstractExecutorService {
/**
* Create a new ExecutorServiceAdapter, using the given target executor.
- * @param concurrentExecutor the target executor to delegate to
+ * @param taskExecutor the target executor to delegate to
*/
public ExecutorServiceAdapter(TaskExecutor taskExecutor) {
Assert.notNull(taskExecutor, "TaskExecutor must not be null"); | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-expression/src/main/java/org/springframework/expression/spel/SpelNode.java | @@ -43,7 +43,7 @@ public interface SpelNode {
/**
* Determine if this expression node will support a setValue() call.
- *
+ *
* @param expressionState the current expression state (includes the context)
* @return true if the expression node will allow setValue()
* @throws EvaluationException if something went wrong trying to determine if the node supports writing
@@ -77,7 +77,7 @@ public interface SpelNode {
/**
* Determine the class of the object passed in, unless it is already a class object.
- * @param o the object that the caller wants the class of
+ * @param obj the object that the caller wants the class of
* @return the class of the object if it is not already a class object, or null if the object is null
*/
Class<?> getObjectClass(Object obj); | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java | @@ -1012,9 +1012,9 @@ <T>List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elem
* Each batch should be of size indicated in 'batchSize'.
* @param sql the SQL statement to execute.
* @param batchArgs the List of Object arrays containing the batch of arguments for the query
- * @param argTypes SQL types of the arguments
- * (constants from <code>java.sql.Types</code>)
- * @return an array containing for each batch another array containing the numbers of rows affected
+ * @param batchSize batch size
+ * @param pss ParameterizedPreparedStatementSetter to use
+ * @return an array containing for each batch another array containing the numbers of rows affected
* by each update in the batch
*/
public <T> int[][] batchUpdate(String sql, Collection<T> batchArgs, int batchSize, ParameterizedPreparedStatementSetter<T> pss); | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-jdbc/src/main/java/org/springframework/jdbc/core/ParameterizedPreparedStatementSetter.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,13 +34,13 @@
* @author Nicolas Fabre
* @author Thomas Risberg
* @since 3.1
- * @see JdbcTemplate#batchUpdate(String sql, Collection<T> objs, int batchSize, ParameterizedPreparedStatementSetter<T> pss)
+ * @see JdbcTemplate#batchUpdate(String, java.util.Collection, int, ParameterizedPreparedStatementSetter)
*/
public interface ParameterizedPreparedStatementSetter<T> {
- /**
+ /**
* Set parameter values on the given PreparedStatement.
- *
+ *
* @param ps the PreparedStatement to invoke setter methods on
* @param argument the object containing the values to be set
* @throws SQLException if a SQLException is encountered (i.e. there is no need to catch SQLException) | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-jdbc/src/main/java/org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseConfigurer.java | @@ -29,7 +29,7 @@ public interface EmbeddedDatabaseConfigurer {
/**
* Configure the properties required to create and connect to the embedded database instance.
- * @param dataSource the data source to configure
+ * @param properties connection properties to configure
* @param databaseName the name of the test database
*/
void configureConnectionProperties(ConnectionProperties properties, String databaseName); | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-jms/src/main/java/org/springframework/jms/support/converter/MappingJacksonMessageConverter.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -346,7 +346,6 @@ protected Object convertFromMessage(Message message, JavaType targetJavaType)
* <p>The default implementation parses the configured type id property name
* and consults the configured type id mapping. This can be overridden with
* a different strategy, e.g. doing some heuristics based on message origin.
- * @param object the payload object to set a type id for
* @param message the JMS Message to set the type id on
* @throws JMSException if thrown by JMS methods
* @see #setTypeIdOnMessage(Object, javax.jms.Message) | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-jms/src/main/java/org/springframework/jms/support/converter/MessageType.java | @@ -19,7 +19,7 @@
/**
* Constants that indicate a target message type to convert to: a
* {@link javax.jms.TextMessage}, a {@link javax.jms.BytesMessage},
- * a {@link javax.jms.MapMessage} or an {@link ObjectMessage}.
+ * a {@link javax.jms.MapMessage} or an {@link javax.jms.ObjectMessage}.
*
* @author Juergen Hoeller
* @since 3.0 | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-orm/src/main/java/org/springframework/orm/hibernate4/LocalSessionFactoryBean.java | @@ -226,7 +226,7 @@ public Properties getHibernateProperties() {
/**
* Specify annotated entity classes to register with this Hibernate SessionFactory.
- * @see org.hibernate.cfg.Configuration#addAnnotatedClass(String)
+ * @see org.hibernate.cfg.Configuration#addAnnotatedClass(Class)
*/
public void setAnnotatedClasses(Class<?>[] annotatedClasses) {
this.annotatedClasses = annotatedClasses; | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-orm/src/main/java/org/springframework/orm/ibatis/SqlMapClientFactoryBean.java | @@ -170,7 +170,6 @@ public void setSqlMapClientProperties(Properties sqlMapClientProperties) {
* @see #setTransactionConfigProperties
* @see com.ibatis.sqlmap.client.SqlMapClient#getDataSource
* @see SqlMapClientTemplate#setDataSource
- * @see SqlMapClientTemplate#queryForPaginatedList
*/
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource; | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-orm/src/main/java/org/springframework/orm/jdo/JdoOperations.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -228,7 +228,6 @@ public interface JdoOperations {
* to rely on auto-flushing at transaction completion.
* @throws org.springframework.dao.DataAccessException in case of JDO errors
* @see javax.jdo.PersistenceManager#flush()
- * @see JdoDialect#flush(javax.jdo.PersistenceManager)
*/
void flush() throws DataAccessException;
| true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-orm/src/main/java/org/springframework/orm/jpa/vendor/EclipseLinkJpaDialect.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,7 +70,7 @@ public class EclipseLinkJpaDialect extends DefaultJpaDialect {
* <p>It is only recommended to switch this flag to "true" when no JDBC access
* code is involved in any of the transactions, and when it is acceptable to
* perform read operations outside of the transactional JDBC Connection.
- * @see oracle.toplink.sessions.UnitOfWork#beginEarlyTransaction()
+ * @see org.eclipse.persistence.sessions.UnitOfWork#beginEarlyTransaction()
*/
public void setLazyDatabaseTransaction(boolean lazyDatabaseTransaction) {
this.lazyDatabaseTransaction = lazyDatabaseTransaction; | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-orm/src/main/java/org/springframework/orm/jpa/vendor/TopLinkJpaDialect.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -68,7 +68,7 @@ public class TopLinkJpaDialect extends DefaultJpaDialect {
* <p>It is only recommended to switch this flag to "true" when no JDBC access
* code is involved in any of the transactions, and when it is acceptable to
* perform read operations outside of the transactional JDBC Connection.
- * @see oracle.toplink.sessions.UnitOfWork#beginEarlyTransaction()
+ * @see oracle.toplink.essentials.sessions.UnitOfWork#beginEarlyTransaction()
*/
public void setLazyDatabaseTransaction(boolean lazyDatabaseTransaction) {
this.lazyDatabaseTransaction = lazyDatabaseTransaction; | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-oxm/src/main/java/org/springframework/oxm/GenericMarshaller.java | @@ -22,7 +22,7 @@
* Subinterface of {@link Marshaller} that has support for Java 5 generics.
*
* @author Arjen Poutsma
- * @sicne 3.0.1
+ * @since 3.0.1
*/
public interface GenericMarshaller extends Marshaller {
| true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-oxm/src/main/java/org/springframework/oxm/GenericUnmarshaller.java | @@ -22,7 +22,7 @@
* Subinterface of {@link Unmarshaller} that has support for Java 5 generics.
*
* @author Arjen Poutsma
- * @sicne 3.0.1
+ * @since 3.0.1
*/
public interface GenericUnmarshaller extends Unmarshaller {
| true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -362,7 +362,7 @@ public void setObject(Object root) {
/**
* Sets whether this unmarshaller should re-use objects. This will be only used when unmarshalling to existing
- * object. </p> The default is {@link false}, which means that the objects won't be re-used.
+ * object. </p> The default is {@code false}, which means that the objects won't be re-used.
*
* @see org.exolab.castor.xml.Unmarshaller#setReuseObjects(boolean)
*/
@@ -371,7 +371,7 @@ public void setReuseObjects(boolean reuseObjects) {
}
/**
- * Sets whether this unmarshaller should clear collections upon the first use. </p> The default is {@link false},
+ * Sets whether this unmarshaller should clear collections upon the first use. </p> The default is {@code false},
* which means that marshaller won't clear collections.
*
* @see org.exolab.castor.xml.Unmarshaller#setClearCollections(boolean) | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-struts/src/main/java/org/springframework/web/struts/ActionSupport.java | @@ -52,7 +52,6 @@
* @see ContextLoaderPlugIn#SERVLET_CONTEXT_PREFIX
* @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
* @see org.springframework.web.context.ContextLoaderListener
- * @see org.springframework.web.context.ContextLoaderServlet
* @see DispatchActionSupport
* @see LookupDispatchActionSupport
* @see MappingDispatchActionSupport | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-struts/src/main/java/org/springframework/web/struts/ContextLoaderPlugIn.java | @@ -97,7 +97,6 @@
* @see DelegatingRequestProcessor
* @see DelegatingTilesRequestProcessor
* @see org.springframework.web.context.ContextLoaderListener
- * @see org.springframework.web.context.ContextLoaderServlet
* @see org.springframework.web.servlet.FrameworkServlet
* @deprecated as of Spring 3.0
*/ | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-struts/src/main/java/org/springframework/web/struts/DispatchActionSupport.java | @@ -52,7 +52,6 @@
* @see ContextLoaderPlugIn#SERVLET_CONTEXT_PREFIX
* @see org.springframework.web.context.WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
* @see org.springframework.web.context.ContextLoaderListener
- * @see org.springframework.web.context.ContextLoaderServlet
* @see ActionSupport
* @see LookupDispatchActionSupport
* @see MappingDispatchActionSupport | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-struts/src/main/java/org/springframework/web/struts/LookupDispatchActionSupport.java | @@ -51,7 +51,6 @@
* @see ContextLoaderPlugIn#SERVLET_CONTEXT_PREFIX
* @see WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
* @see org.springframework.web.context.ContextLoaderListener
- * @see org.springframework.web.context.ContextLoaderServlet
* @see ActionSupport
* @see DispatchActionSupport
* @see MappingDispatchActionSupport | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-struts/src/main/java/org/springframework/web/struts/MappingDispatchActionSupport.java | @@ -51,7 +51,6 @@
* @see ContextLoaderPlugIn#SERVLET_CONTEXT_PREFIX
* @see WebApplicationContext#ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
* @see org.springframework.web.context.ContextLoaderListener
- * @see org.springframework.web.context.ContextLoaderServlet
* @see ActionSupport
* @see DispatchActionSupport
* @see LookupDispatchActionSupport | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-test/src/main/java/org/springframework/test/context/ContextConfigurationAttributes.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,10 +23,10 @@
import org.springframework.util.ObjectUtils;
/**
- * <code>ContextConfigurationAttributes</code> encapsulates the context
+ * <code>ContextConfigurationAttributes</code> encapsulates the context
* configuration attributes declared on a test class via
* {@link ContextConfiguration @ContextConfiguration}.
- *
+ *
* @author Sam Brannen
* @since 3.1
* @see ContextConfiguration
@@ -52,7 +52,7 @@ public class ContextConfigurationAttributes {
* Resolve resource locations from the {@link ContextConfiguration#locations() locations}
* and {@link ContextConfiguration#value() value} attributes of the supplied
* {@link ContextConfiguration} annotation.
- *
+ *
* @throws IllegalStateException if both the locations and value attributes have been declared
*/
private static String[] resolveLocations(Class<?> declaringClass, ContextConfiguration contextConfiguration) {
@@ -81,7 +81,7 @@ else if (!ObjectUtils.isEmpty(valueLocations)) {
* supplied {@link ContextConfiguration @ContextConfiguration} annotation and
* the {@link Class test class} that declared it.
* @param declaringClass the test class that declared {@code @ContextConfiguration}
- * @param contextConfiguration the annotation from which to retrieve the attributes
+ * @param contextConfiguration the annotation from which to retrieve the attributes
*/
public ContextConfigurationAttributes(Class<?> declaringClass, ContextConfiguration contextConfiguration) {
this(declaringClass, resolveLocations(declaringClass, contextConfiguration), contextConfiguration.classes(),
@@ -93,14 +93,14 @@ public ContextConfigurationAttributes(Class<?> declaringClass, ContextConfigurat
* {@link Class test class} that declared the
* {@link ContextConfiguration @ContextConfiguration} annotation and its
* corresponding attributes.
- *
+ *
* @param declaringClass the test class that declared {@code @ContextConfiguration}
* @param locations the resource locations declared via {@code @ContextConfiguration}
* @param classes the configuration classes declared via {@code @ContextConfiguration}
* @param inheritLocations the <code>inheritLocations</code> flag declared via {@code @ContextConfiguration}
* @param contextLoaderClass the {@code ContextLoader} class declared via {@code @ContextConfiguration}
* @throws IllegalArgumentException if the {@code declaringClass} or {@code contextLoaderClass} is
- * <code>null</code>, or if the {@code locations} and {@code classes} are both non-empty
+ * <code>null</code>, or if the {@code locations} and {@code classes} are both non-empty
*/
public ContextConfigurationAttributes(Class<?> declaringClass, String[] locations, Class<?>[] classes,
boolean inheritLocations, Class<? extends ContextLoader> contextLoaderClass) {
@@ -138,12 +138,12 @@ public Class<?> getDeclaringClass() {
* Get the resource locations that were declared via
* {@link ContextConfiguration @ContextConfiguration}.
* <p>Note: this is a mutable property. The returned value may therefore
- * represent a <em>processed</em> value that does not match the original value
+ * represent a <em>processed</em> value that does not match the original value
* declared via {@link ContextConfiguration @ContextConfiguration}.
* @return the resource locations; potentially <code>null</code> or <em>empty</em>
* @see ContextConfiguration#value
* @see ContextConfiguration#locations
- * @see #setLocations()
+ * @see #setLocations(String[])
*/
public String[] getLocations() {
return locations;
@@ -162,11 +162,11 @@ public void setLocations(String[] locations) {
* Get the configuration classes that were declared via
* {@link ContextConfiguration @ContextConfiguration}.
* <p>Note: this is a mutable property. The returned value may therefore
- * represent a <em>processed</em> value that does not match the original value
+ * represent a <em>processed</em> value that does not match the original value
* declared via {@link ContextConfiguration @ContextConfiguration}.
* @return the configuration classes; potentially <code>null</code> or <em>empty</em>
* @see ContextConfiguration#classes
- * @see #setClasses()
+ * @see #setClasses(Class[])
*/
public Class<?>[] getClasses() {
return classes;
@@ -182,7 +182,7 @@ public void setClasses(Class<?>[] classes) {
}
/**
- * Determine if this {@code ContextConfigurationAttributes} instance has
+ * Determine if this {@code ContextConfigurationAttributes} instance has
* path-based resource locations.
* @return <code>true</code> if the {@link #getLocations() locations} array is not empty
* @see #hasResources()
@@ -193,7 +193,7 @@ public boolean hasLocations() {
}
/**
- * Determine if this {@code ContextConfigurationAttributes} instance has
+ * Determine if this {@code ContextConfigurationAttributes} instance has
* class-based resources.
* @return <code>true</code> if the {@link #getClasses() classes} array is not empty
* @see #hasResources()
@@ -204,7 +204,7 @@ public boolean hasClasses() {
}
/**
- * Determine if this {@code ContextConfigurationAttributes} instance has
+ * Determine if this {@code ContextConfigurationAttributes} instance has
* either path-based resource locations or class-based resources.
* @return <code>true</code> if either the {@link #getLocations() locations}
* or the {@link #getClasses() classes} array is not empty | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-test/src/main/java/org/springframework/test/context/SmartContextLoader.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,7 +21,7 @@
/**
* Strategy interface for loading an {@link ApplicationContext application context}
* for an integration test managed by the Spring TestContext Framework.
- *
+ *
* <p>The {@code SmartContextLoader} SPI supersedes the {@link ContextLoader} SPI
* introduced in Spring 2.5: a {@code SmartContextLoader} can choose to process
* either resource locations or configuration classes. Furthermore, a
@@ -34,13 +34,13 @@
* processContextConfiguration()} prior to calling
* {@link #loadContext(MergedContextConfiguration) loadContext()}. This gives a
* {@code SmartContextLoader} the opportunity to provide custom support for
- * modifying resource locations or detecting default resource locations or
+ * modifying resource locations or detecting default resource locations or
* default configuration classes. The results of
* {@link #processContextConfiguration(ContextConfigurationAttributes)
* processContextConfiguration()} should be merged for all classes in the
* hierarchy of the root test class and then supplied to
* {@link #loadContext(MergedContextConfiguration) loadContext()}.
- *
+ *
* <p>Even though {@code SmartContextLoader} extends {@code ContextLoader},
* clients should favor {@code SmartContextLoader}-specific methods over those
* defined in {@code ContextLoader}, particularly because a
@@ -97,7 +97,7 @@ public interface SmartContextLoader extends ContextLoader {
* {@link org.springframework.beans.factory.annotation.Autowired @Autowired},
* {@link javax.annotation.Resource @Resource}, and
* {@link javax.inject.Inject @Inject}. In addition, concrete implementations
- * should set the active bean definition profiles in the context's
+ * should set the active bean definition profiles in the context's
* {@link org.springframework.core.env.Environment Environment}.
* <p>Any <code>ApplicationContext</code> loaded by a
* {@code SmartContextLoader} <strong>must</strong> register a JVM
@@ -110,7 +110,8 @@ public interface SmartContextLoader extends ContextLoader {
* @return a new application context
* @throws Exception if context loading failed
* @see #processContextConfiguration(ContextConfigurationAttributes)
- * @see org.springframework.context.annotation.AnnotationConfigUtils#registerAnnotationConfigProcessors()
+ * @see org.springframework.context.annotation.AnnotationConfigUtils
+ * #registerAnnotationConfigProcessors(org.springframework.beans.factory.support.BeanDefinitionRegistry)
* @see org.springframework.test.context.MergedContextConfiguration#getActiveProfiles()
* @see org.springframework.context.ConfigurableApplicationContext#getEnvironment()
*/ | true |
Other | spring-projects | spring-framework | effb762558f152ed60f5bd6aedb4c7b5ea65db4a.json | Fix javadoc warnings
Before this change there were numerous javadoc warnings being reported
while building Spring framework API.
This commit resolves most of the javadoc warnings, reducing the total
number from 265 to 103.
Issue: SPR-9113 | spring-test/src/main/java/org/springframework/test/context/junit4/statements/RunAfterTestMethodCallbacks.java | @@ -1,5 +1,5 @@
/*
- * Copyright 2002-2011 the original author or authors.
+ * Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,9 +28,9 @@
* <code>RunAfterTestMethodCallbacks</code> is a custom JUnit 4.5+
* {@link Statement} which allows the <em>Spring TestContext Framework</em> to
* be plugged into the JUnit execution chain by calling
- * {@link TestContextManager#afterTestMethod(Object, Method) afterTestMethod()}
+ * {@link TestContextManager#afterTestMethod(Object, Method, Throwable) afterTestMethod()}
* on the supplied {@link TestContextManager}.
- *
+ *
* @see #evaluate()
* @see RunBeforeTestMethodCallbacks
* @author Sam Brannen
@@ -50,7 +50,7 @@ public class RunAfterTestMethodCallbacks extends Statement {
/**
* Constructs a new <code>RunAfterTestMethodCallbacks</code> statement.
- *
+ *
* @param next the next <code>Statement</code> in the execution chain
* @param testInstance the current test instance (never <code>null</code>)
* @param testMethod the test method which has just been executed on the
@@ -70,7 +70,7 @@ public RunAfterTestMethodCallbacks(Statement next, Object testInstance, Method t
* Invokes the next {@link Statement} in the execution chain (typically an
* instance of {@link org.junit.internal.runners.statements.RunAfters
* RunAfters}), catching any exceptions thrown, and then calls
- * {@link TestContextManager#afterTestMethod(Object, Method)} with the first
+ * {@link TestContextManager#afterTestMethod(Object, Method, Throwable)} with the first
* caught exception (if any). If the call to <code>afterTestMethod()</code>
* throws an exception, it will also be tracked. Multiple exceptions will be
* combined into a {@link MultipleFailureException}. | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.