Polishing
This commit is contained in:
parent
65f29a39ca
commit
58e9706991
|
|
@ -177,13 +177,15 @@ public class JdbcTemplateTests {
|
|||
|
||||
@Test
|
||||
public void testStringsWithEmptyPreparedStatementArgs() throws Exception {
|
||||
doTestStrings(null, null, null, null, (template, sql, rch) -> template.query(sql, (Object[]) null, rch));
|
||||
doTestStrings(null, null, null, null,
|
||||
(template, sql, rch) -> template.query(sql, (Object[]) null, rch));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStringsWithPreparedStatementArgs() throws Exception {
|
||||
final Integer argument = 99;
|
||||
doTestStrings(null, null, null, argument, (template, sql, rch) -> template.query(sql, new Object[] { argument }, rch));
|
||||
doTestStrings(null, null, null, argument,
|
||||
(template, sql, rch) -> template.query(sql, new Object[] {argument}, rch));
|
||||
}
|
||||
|
||||
private void doTestStrings(Integer fetchSize, Integer maxRows, Integer queryTimeout,
|
||||
|
|
@ -363,7 +365,7 @@ public class JdbcTemplateTests {
|
|||
given(this.preparedStatement.executeUpdate()).willReturn(rowsAffected);
|
||||
|
||||
int actualRowsAffected = this.template.update(sql,
|
||||
new Object[] {4, new SqlParameterValue(Types.NUMERIC, 2, Float.valueOf(1.4142f))});
|
||||
4, new SqlParameterValue(Types.NUMERIC, 2, Float.valueOf(1.4142f)));
|
||||
assertTrue("Actual rows affected is correct", actualRowsAffected == rowsAffected);
|
||||
verify(this.preparedStatement).setObject(1, 4);
|
||||
verify(this.preparedStatement).setObject(2, Float.valueOf(1.4142f), Types.NUMERIC, 2);
|
||||
|
|
@ -428,8 +430,7 @@ public class JdbcTemplateTests {
|
|||
public void testBatchUpdateWithBatchFailure() throws Exception {
|
||||
final String[] sql = {"A", "B", "C", "D"};
|
||||
given(this.statement.executeBatch()).willThrow(
|
||||
new BatchUpdateException(new int[] { 1, Statement.EXECUTE_FAILED, 1,
|
||||
Statement.EXECUTE_FAILED }));
|
||||
new BatchUpdateException(new int[] {1, Statement.EXECUTE_FAILED, 1, Statement.EXECUTE_FAILED}));
|
||||
mockDatabaseMetaData(true);
|
||||
given(this.connection.createStatement()).willReturn(this.statement);
|
||||
|
||||
|
|
@ -496,11 +497,9 @@ public class JdbcTemplateTests {
|
|||
given(this.preparedStatement.executeBatch()).willReturn(rowsAffected);
|
||||
mockDatabaseMetaData(true);
|
||||
|
||||
BatchPreparedStatementSetter setter =
|
||||
new BatchPreparedStatementSetter() {
|
||||
BatchPreparedStatementSetter setter = new BatchPreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps, int i)
|
||||
throws SQLException {
|
||||
public void setValues(PreparedStatement ps, int i) throws SQLException {
|
||||
ps.setInt(1, ids[i]);
|
||||
}
|
||||
@Override
|
||||
|
|
@ -1050,10 +1049,9 @@ public class JdbcTemplateTests {
|
|||
}
|
||||
|
||||
try {
|
||||
this.template.query(con -> con.prepareStatement("my query"),
|
||||
(ResultSetExtractor<Object>) rs2 -> {
|
||||
throw new InvalidDataAccessApiUsageException("");
|
||||
} );
|
||||
this.template.query(con -> con.prepareStatement("my query"), (ResultSetExtractor<Object>) rs2 -> {
|
||||
throw new InvalidDataAccessApiUsageException("");
|
||||
});
|
||||
fail("Should have thrown InvalidDataAccessApiUsageException");
|
||||
}
|
||||
catch (InvalidDataAccessApiUsageException ex) {
|
||||
|
|
|
|||
|
|
@ -71,13 +71,13 @@ class ControllerMethodResolver {
|
|||
/**
|
||||
* MethodFilter that matches {@link InitBinder @InitBinder} methods.
|
||||
*/
|
||||
public static final MethodFilter INIT_BINDER_METHODS = method ->
|
||||
private static final MethodFilter INIT_BINDER_METHODS = method ->
|
||||
AnnotatedElementUtils.hasAnnotation(method, InitBinder.class);
|
||||
|
||||
/**
|
||||
* MethodFilter that matches {@link ModelAttribute @ModelAttribute} methods.
|
||||
*/
|
||||
public static final MethodFilter MODEL_ATTRIBUTE_METHODS = method ->
|
||||
private static final MethodFilter MODEL_ATTRIBUTE_METHODS = method ->
|
||||
(!AnnotatedElementUtils.hasAnnotation(method, RequestMapping.class) &&
|
||||
AnnotatedElementUtils.hasAnnotation(method, ModelAttribute.class));
|
||||
|
||||
|
|
@ -217,7 +217,6 @@ class ControllerMethodResolver {
|
|||
}
|
||||
|
||||
private void initControllerAdviceCaches(ApplicationContext applicationContext) {
|
||||
|
||||
List<ControllerAdviceBean> beans = ControllerAdviceBean.findAnnotatedBeans(applicationContext);
|
||||
AnnotationAwareOrderComparator.sort(beans);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
|
|
@ -66,31 +66,29 @@ public class HandlerMethodAnnotationDetectionTests {
|
|||
@Parameters(name = "controller [{0}], auto-proxy [{1}]")
|
||||
public static Object[][] handlerTypes() {
|
||||
return new Object[][] {
|
||||
{ SimpleController.class, true }, // CGLIB proxy
|
||||
{ SimpleController.class, false },
|
||||
|
||||
{ SimpleController.class, true }, // CGLIB proxy
|
||||
{ SimpleController.class, false },
|
||||
{ AbstractClassController.class, true }, // CGLIB proxy
|
||||
{ AbstractClassController.class, false },
|
||||
|
||||
{ AbstractClassController.class, true }, // CGLIB proxy
|
||||
{ AbstractClassController.class, false },
|
||||
{ ParameterizedAbstractClassController.class, true }, // CGLIB proxy
|
||||
{ ParameterizedAbstractClassController.class, false },
|
||||
|
||||
{ ParameterizedAbstractClassController.class, true }, // CGLIB proxy
|
||||
{ ParameterizedAbstractClassController.class, false },
|
||||
{ ParameterizedSubclassOverridesDefaultMappings.class, true }, // CGLIB proxy
|
||||
{ ParameterizedSubclassOverridesDefaultMappings.class, false },
|
||||
|
||||
{ ParameterizedSubclassOverridesDefaultMappings.class, true }, // CGLIB proxy
|
||||
{ ParameterizedSubclassOverridesDefaultMappings.class, false },
|
||||
// TODO [SPR-9517] Enable ParameterizedSubclassDoesNotOverrideConcreteImplementationsFromGenericAbstractSuperclass test cases
|
||||
// { ParameterizedSubclassDoesNotOverrideConcreteImplementationsFromGenericAbstractSuperclass.class, true }, // CGLIB proxy
|
||||
// { ParameterizedSubclassDoesNotOverrideConcreteImplementationsFromGenericAbstractSuperclass.class, false },
|
||||
|
||||
// TODO [SPR-9517] Enable ParameterizedSubclassDoesNotOverrideConcreteImplementationsFromGenericAbstractSuperclass test cases
|
||||
// { ParameterizedSubclassDoesNotOverrideConcreteImplementationsFromGenericAbstractSuperclass.class, true }, // CGLIB proxy
|
||||
// { ParameterizedSubclassDoesNotOverrideConcreteImplementationsFromGenericAbstractSuperclass.class, false },
|
||||
{ InterfaceController.class, true }, // JDK dynamic proxy
|
||||
{ InterfaceController.class, false },
|
||||
|
||||
{ InterfaceController.class, true }, // JDK dynamic proxy
|
||||
{ InterfaceController.class, false },
|
||||
|
||||
{ ParameterizedInterfaceController.class, false }, // no AOP
|
||||
|
||||
{ SupportClassController.class, true }, // CGLIB proxy
|
||||
{ SupportClassController.class, false }
|
||||
{ ParameterizedInterfaceController.class, false }, // no AOP
|
||||
|
||||
{ SupportClassController.class, true }, // CGLIB proxy
|
||||
{ SupportClassController.class, false }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2031,6 +2031,7 @@ through the `ObjectMapper` property for cases where custom JSON
|
|||
serializers/deserializers need to be provided for specific types.
|
||||
|
||||
|
||||
|
||||
[[mvc-view-xml-mapping]]
|
||||
=== XML
|
||||
[.small]#<<web-reactive.adoc#webflux-view-httpmessagewriter,Same in Spring WebFlux>>#
|
||||
|
|
|
|||
Loading…
Reference in New Issue