说明:
1) Set Character Encoding:字符编码过滤器 2) summercool:summercool框架过滤器
3) 只要配置上面两个filter即完成了应用框架的启动配置
Summercool相关配置文件加载及说明
1) summercool框架会自动扫描:/spring/*.xml文件夹下面的所有的Spring配置
文件。
说明:上图中的/spring文件夹下面的Spring配置文件全部都会自动加载,包括依赖的项目或是jar里包括的/spring的文夹下面的配置文件。 2) 在healthcloud应用里面,一共预先建立了下面几个配置文件:
a) applicationContext.xml b) cache-init-config.xml c) cookie-configurer.xml d) exception-configurer.xml e) healthcloud-module.xml f) healthcloud-service.xml g) monitor-configurer.xml h) security-configurer.xml i) url-configurer.xml
说明:在上面几个配置文件中,要想要healthcloud应用跑里面,上面
applicationContext.xml和healthcloud-module.xml这两个配置文件是不可缺少的。
1) applicationContextml里面配置的是healthcloud页面模版信息和一些
Spring MVC框架的配置信息。
2) Healthcloud-module.xml里面配置的是信息是summercool的一些请求映
射信息等。是整个summercool框架的核心配置文件之一;下面会详细讲解。
applicationContext.xml配置文件说明
xmlns:context=\ xmlns:util=\ xmlns:tx=\ xsi:schemaLocation=\ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd\> class=\erConfigurer\> class=\Resolver\> class=\tionResolver\> class=\> value=\/> class=\actoryBean\> value=\/> class=\Configurer\> class=\ker.FreeMarkerErrorFunction\/> class=\ViewResolver\> 说明: 1) propertyConfigurer:该配置是用来配置Spring注入的一些变量信息。目 前里面只是有FreeMarker的模版路径和模版缓存时间。 2) MultipartResolver:如果你的Spring MVC中需要使用到文件上传的功能, 则需要配置这个类。默认Spring MVC是不支持文件上传的,只有配了这个类才会支持多文件上传;否则不起到作用。具体的用法,有时间笔者会给出例子,因为是标准的Spring MVC多文件上传,在这里不多作说明。 3) HandlerExceptionResolver:全局错误处理器;在Spring MVC在系统发生 异常的情况,会交给这个统一错误处理类来处理。比如说,上面配置中“defaultErrorView”属性可以告诉如果系统发生异常, 则要显示的默认处理页面(注:支持【 redirect: 】等这样的Spring MVC框架中View对象的语法)。 4) freemarkerConfiguration:设置的是Spring MVC中freemarker页面模版 的信息。在这里做了一点更改,支持classpath:下面的freemarker模版的加载,别的没有做任何的变动。具体的freemarker模版设置网上有很多的资类可以参数,都在这里不多做介绍了。 5) uriModuleConstants:这个配置比较关键,是配置freemarker页面中的全 局参数的一个map。比如说,我想让 freemarker页面加入一个全局变量