Spring
共 4 篇文章
spring 多环境配置
常常在开发,测试,发布时的配置是不一样的,比如数据库连接,那么要创建bean的时候,就得给不同的参数,这一点,spring 4 已经考虑到了。主要是使用以下几点 1. xml 配置文件的末尾,写 <beans profile="xxx" >...</beans>, xxx 表明profile的名字,可以任意取,注意:这部份内容必须写在所有配置之后。以下的例子就配置了开发(dev) 和部署(product)两个配置,分别加载不同的配置文件(dev-db.properties 和 product-db.properties <beans profile="dev"> <bean class="o…
Spring 事务配置时漏写一行引起Write operations are not allowed in read-only mode
Spring 事务配置时漏写一行引起Write operations are not allowed in read-only mode 这一行是: <tx:annotation-driven />
2015-02-03 01:43 · Spring · java Spring
Sping 中的 beanFactory 与 FactoryBean
Spring 中有两个最最基本的接口:BeanFactory 与 FactoryBean,可以说是核心中的核心。 简单的说, BeanFactory 就是容器提供给使用者 获取Bean 的接口,Spring中的ApplicationContext 就是实现了这个接口。粗糙的理解: BeanFactory 就是容器。 而 FactoryBean 则是 产生Bean的工厂 ,许多时候,简单的通过Spring 实例化一个Bean,并不能满足我们的需求,最明显的例子就是 数据库的连接池 ,这个连接池就是一个FactoryBean。Spring 如果发现某个Bean实现了*FactoryBean,*那…
2015-01-22 00:35 · Spring · java Spring
Sping mvc DispatcherServlet 处理请求的详细过程
1. 通过WebApplicationContext, 根据request 搜索一些属性,并绑定到request上 2. 通过 Local Resovler ,判定出本地化资源,绑定到request上 3. 通过 Theme Resovler ,判定出主题资源,绑定到request上 4. 如果指定了 multipart resovler ,multipart resolver 会判断,请求中是不是带上传文件,如果是,会把request 再包装成 MultipartHttpServletRequest 5. 找到控制器,并执行 6. 如果有Model返回,则根据返回,找到相应的view 进行…
2014-12-31 12:05 · Spring · spring mvc