javaweb icon indicating copy to clipboard operation
javaweb copied to clipboard

http://www1350.github.io/

Results 100 javaweb issues
Sort by recently updated
recently updated
newest added

# 1.SqlSessionTemplate解析 我们要使用的时候通常 ``` ``` ``` public SqlSessionTemplate(SqlSessionFactory sqlSessionFactory) { this(sqlSessionFactory, sqlSessionFactory.getConfiguration().getDefaultExecutorType()); } public SqlSessionTemplate(SqlSessionFactory sqlSessionFactory, ExecutorType executorType) { this(sqlSessionFactory, executorType, new MyBatisExceptionTranslator( sqlSessionFactory.getConfiguration().getEnvironment().getDataSource(), true)); } public SqlSessionTemplate(SqlSessionFactory sqlSessionFactory, ExecutorType...

Spring

Catalina ``` digester.addRule("Server/Service/Connector", new ConnectorCreateRule()); digester.addRule("Server/Service/Connector", new SetAllPropertiesRule(new String[]{"executor", "sslImplementationName"})); digester.addSetNext("Server/Service/Connector", "addConnector", "org.apache.catalina.connector.Connector"); ``` ConnectorCreateRule ``` @Override public void begin(String namespace, String name, Attributes attributes) throws Exception { Service svc...

tomcat

# Lifecycle接口 ``` /** * Add a LifecycleEvent listener to this component. * * @param listener The listener to add */ public void addLifecycleListener(LifecycleListener listener);//给该组将添加一个监听器 /** * Get the life...

tomcat

之前我们看到其实启动脚本就是使用Bootstrap 的main启动的 # 解析Bootstrap Bootstrap 的main ``` public static void main(String args[]) { if (daemon == null) { // Don't set daemon until init() has completed Bootstrap bootstrap = new...

tomcat

我们来看下startup.sh ``` #!/bin/sh # Better OS/400 detection: see Bugzilla 31132 os400=false case "`uname`" in OS400*) os400=true;; esac # $0 表示Shell本身的文件名 PRG="$0" while [ -h "$PRG" ] ; do #取到软连接的真实文件或真实目录 ls=`ls...

tomcat

首先通过继承BeanDefinitionParser的触发过程看http://www1350.github.io/#post/84 ![sequencediagram11](https://user-images.githubusercontent.com/7789698/37197018-fc2e50b4-23b3-11e8-90bb-3d4ff69603ce.png) 通过继承NamespaceHandlerSupport来注册,最核心的类就是AnnotationAwareAspectJAutoProxyCreator 既然AnnotationAwareAspectJAutoProxyCreator被注册了,而且实现了BeanPostProcessor(每个bean实例化都会过),我们先来看下 ``` @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (bean != null) { Object cacheKey = getCacheKey(bean.getClass(), beanName); if (!this.earlyProxyReferences.contains(cacheKey)) { return wrapIfNecessary(bean,...

Spring

一般要让springmvc生效,我们都在web.xml配上这么一段 ``` dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher / ``` 记得以前很早的时候刚开始学java web的时候都是直接继承HttpServlet然后写的,这个当然也不例外, ![image](https://user-images.githubusercontent.com/7789698/32280463-f0a242e8-bee9-11e7-973d-9c9b3a9461c8.png) ![sequencediagram1](https://user-images.githubusercontent.com/7789698/32544587-d40df77e-c4b3-11e7-8e2d-c77cb5e1c3c9.png) Servlet接口 包括 `public void init(ServletConfig config) throws ServletException;`、 ` public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException;`、`public...

Spring

从 维基百科 中,可以让你对大部分设计模式有一个概览,而且它也指出了哪些设计模式是 GoF 中规范.下面列出可以从 JavaSE 和 JavaEE API 中找到的设计模式: 创建型模式 抽象工厂 javax.xml.parsers.DocumentBuilderFactory#newInstance() javax.xml.transform.TransformerFactory#newInstance() javax.xml.xpath.XPathFactory#newInstance() 建造者模式 java.lang.StringBuilder#append()(非同步) java.lang.StringBuffer#append()(同步) java.nio.ByteBuffer#put()(类似的还有, CharBuffer, ShortBuffer, IntBuffer, LongBuffer, FloatBuffer 和 DoubleBuffer) javax.swing.GroupLayout.Group#addComponent() 工厂模式 java.util.Calendar#getInstance() java.util.ResourceBundle#getBundle()...

java基础

http://seanlook.com/2016/05/27/mysql-pt-online-schema-change/ https://segmentfault.com/a/1190000005642807 https://help.aliyun.com/knowledge_detail/41734.html http://seanlook.com/2016/05/24/mysql-online-ddl-concept/ https://help.aliyun.com/knowledge_detail/41723.html

事务传播属性 ``` @Transactional(propagation=Propagation.REQUIRED) //如果有事务,那么加入事务,没有的话新建一个(不写的情况下) **默认** @Transactional(propagation=Propagation.NOT_SUPPORTED) //容器不为这个方法开启事务 @Transactional(propagation=Propagation.REQUIRES_NEW) //不管是否存在事务,都创建一个新的事务,原来的挂起,新的执行完毕,继续执行老的事务 @Transactional(propagation=Propagation.MANDATORY) //必须在一个已有的事务中执行,否则抛出异常 @Transactional(propagation=Propagation.NEVER) //必须在一个没有的事务中执行,否则抛出异常(与Propagation.MANDATORY相反) @Transactional(propagation=Propagation.SUPPORTS) //如果其他bean调用这个方法,在其他bean中声明事务,那就用事务.如果其他bean没有声明事务,那就不用事务. @Transactional(propagation=Propagation.NESTED) //如果当前存在事务,则在嵌套事务内执行。如果当前没有事务,则进行与PROPAGATION_REQUIRED类似的操作。 @Transactional (propagation = Propagation.REQUIRED,readOnly=true) //readOnly=true只读,不能更新,删除 @Transactional (propagation = Propagation.REQUIRED,timeout=30)//设置超时时间 @Transactional (propagation = Propagation.REQUIRED,isolation=Isolation.DEFAULT)//设置数据库隔离级别...

Spring