transactionLog.logConnectException(e); return Receipt.forSystemFailure(e.getMessage()); } } } 3.测试 List BillingService.class); billingService.chargeOrder(new PizzaOrder(), new CreditCard()); } } List 图1 List-5的运行结果 (adsbygoogle = window.adsbygoogle || []).push({});
如下List-5所示: List-5 public class MapperFactoryBean<T> extends SqlSessionDaoSupport implements FactoryBean List-5的getObject()中,调用父类SqlSessionDaoSupport的方法getSqlSession(),来看下SqlSessionDaoSupport,如下List-6 List 不过还是遗留了很多问题,比如最重要的,List-5中SqlSessionTemplate的.getMapper(this.mapperInterface)方法底层上是如何实现的。
图3 List-4的运行结果 List-5 import org.openjdk.jol.info.ClassLayout; import org.openjdk.jol.vm.VM; /** * System.out.println(layout.toPrintable()); } public static class A { long f; } } List 图4 List-5的运行结果 我们来对比下图3和图4的结果,图3中显示对象占了16bytes,但是图4中显示对象占了24bytes。 我们给List-5中的类,加上get/set/constructor,如下List-6 List-6 类A加上get/set/contructor public class A { long String toString() { return "A{" + "f=" + f + '}'; } } 再用List
RequestResponseBodyAdviceChain的afterBodyRead中,调用getMatchingAdvice方法,获取RequestBodyAdvice类型的advice,如下List advice.afterBodyRead(body, inputMessage, parameter, targetType, converterType); } } return body; } List ; } else { throw new IllegalArgumentException("Unexpected adviceType: " + adviceType); } } List ArgumentResolverAdvice 4处判断这个类是否是RequestBodyAdvice类型,如果不是则不会加到结果集,所以就是我们要实现RequestBodyAdvice的原因 List
handlerMethodsInitialized(getHandlerMethods()); } 来看List-4中的方法detectHandlerMethods,传入的是String类型的bean name,如下List List-5 protected void detectHandlerMethods(Object handler) { Class<? builder.customCondition(customCondition); } return builder.options(this.config).build(); } List
则会报错 4处获取resultMap,从List中 5处是核心,调用handleResultSet->handleRowValues->handleRowValuesForSimpleResultMap List List-5的1处,调用getRowValue方法,该方法获取resultSet中的一行数据,并将数据封装位对象 List-6 private Object getRowValue(ResultSetWrapper 回到List-5中,getRowValue方法返回值,storeObject方法中将值放入到List中。 描述较为泛华,建议个人阅读源码。
objects); System.out.println(method.getName()+" 后"); return result; } } 来测试下,如下List HelloWorldSubject.class.getInterfaces(), new JdbcDynamicalProxy(subject)); instance.print(); } } List
AllArgsConstructor public class OfficeStaff { private String name; private Integer age; } 如下List List-5 Department对象在Redis中存储的是json 127.0.0.1:6379[7]> get "\"System\"" "{\"@class\":\"com.mjduan.project.objectRedisTemplate.model.Department 思考: List-5中,Department并没有名为"@class"的属性,那么它是怎么被添加进去的呢,这个问题暂时不研究了。
=4 --mysql-host=localhost --mysql-db=foo --mysql-user=root --mysql-password=密码 prepare 2. run分析结果 List events (avg/stddev): 7.9940/3.22 execution time (avg/stddev): 10.2680/0.14 从List-3和List
Springboot中SpringApplicationRunListener的默认实现有个EventPublishingRunListener,如下List-5所示 List-5 public class 如List-5中所示,Springboot启动的不同阶段,会传不同的event实现给EventPublishingRunListener,而EventPublishingRunListener则用Delete
的最后,有如下List-4,调用HandlerExecutionChain的triggerAfterCompletion,会逆序调用HandlerInterceptor的afterCompletion,由List = null) { mappedHandler.triggerAfterCompletion(request, response, null); } } List-5 void triggerAfterCompletion threw exception", ex2); } } } } 位置7/8,如果之前的步骤抛出异常,就会到步骤7/8,调用triggerAfterCompletion,并将异常作为参数传入,由List
ReflectionUtils.makeAccessible(method); return method.invoke(target, args); ... } 如下的List List-5 public class AspectJAfterAdvice extends AbstractAspectJAdvice implements MethodInterceptor,
} } finally { if (failed) cancelAcquire(node); } } 2.countDown() List -5 public void countDown() { sync.releaseShared(1); } 如List-5,内部调用了Sync的releaseShared(1),即释放1
ScannedGenericBeanDefinition,所以这个俩个处理方法都会被调用,我们来看下AnnotationConfigUtils.processCommonDefinitionAnnotations,如下List -5: List-5 public static void processCommonDefinitionAnnotations(AnnotatedBeanDefinition abd) { List-5中处理完了后,回到List-2,方法registerBeanDefinition将这个BeanDefinition注册到Spring容器中。 2.
org.springframework.boot.env.PropertiesPropertySourceLoader,\ org.springframework.boot.env.YamlPropertySourceLoader PropertiesPropertySourceLoader如下List List-5 public class PropertiesPropertySourceLoader implements PropertySourceLoader { public String
ServerBootstrapAcceptor.channelRead()中,childGroup.register(child),这里的child是netty封装后的JDK channel,转交给childGroup,如下List List-5 @Override public ChannelFuture register(Channel channel) { return next().register(channel) ; } List-5中register()只是在这个channel上注册read事件监听,待这个channel上有read事件,即有数据可读时就会进行read。
在node1上,用如下List-5命令创建卷,卷名称是db_volume List-5 gluster volume create db_volume \ replica 3 node1:/data_gluster
来看下FeignContext的父类NamedContextFactory,List-5中的setConfigurations方法在List-3中调用,在构造FeignContext的时候调用的。 List-5 public void setConfigurations(List<C> configurations) { for (C client : configurations) {
(); } 如果List-3返回的getFilters不为空,那么会构造一个VirtualFilterChain,并调用它的doFilter,下面来看下VirtualFilterChain,如List List-5 VirtualFilterChain的属性及构造方法 private static class VirtualFilterChain implements FilterChain {
来看个例子,如下List-5所示,MethodBeforeAdviceAdapter的supportsAdvice方法中判断是否是MethodBeforeAdvice;getInterceptor方法中将 List-5 class MethodBeforeAdviceAdapter implements AdvisorAdapter, Serializable { @Override public