南宁学网站开发,东莞网站建设在哪里,专业网站建设公司怎么选,应该选用哪种口罩原文#xff1a;http://www.cnblogs.com/LiuChunfu/p/5605473.html
------------------------------------------------------------------------------ 一、引入其他 模块XML
在Spring的配置文件#xff0c;有时候为了分模块的更加清晰的进行相关实体类的配置。
比如…原文http://www.cnblogs.com/LiuChunfu/p/5605473.html
------------------------------------------------------------------------------ 一、引入其他 模块XML
在Spring的配置文件有时候为了分模块的更加清晰的进行相关实体类的配置。
比如现在有一个job-timer.xml的配置 ?xml version1.0 encodingUTF-8?
beans xmlnshttp://www.springframework.org/schema/beans xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd!-- 要执行任务的任务类。 --bean idtestQuartz classcom.mc.bsframe.job.TestJob/bean!-- 将需要执行的定时任务注入JOB中。 --bean idtestJob classorg.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBeanproperty nametargetObject reftestQuartz/property!-- 任务类中需要执行的方法 --property nametargetMethod valuedoSomething/property!-- 上一次未执行完成的要等待有再执行。 --property nameconcurrent valuefalse/property/bean!-- 基本的定时器会绑定具体的任务。 --bean idtestTrigger classorg.springframework.scheduling.quartz.SimpleTriggerFactoryBeanproperty namejobDetail reftestJob/propertyproperty namestartDelay value3000/propertyproperty namerepeatInterval value200000/property/beanbean idscheduler classorg.springframework.scheduling.quartz.SchedulerFactoryBeanproperty nametriggerslistref beantestTrigger/ref/list/property/bean
/beans 在Spring的整体的配置文件中使用 import resourceclasspath*:/spring/job-timer.xml /引入。 ?xml version1.0 encodingUTF-8?
beans xmlnshttp://www.springframework.org/schema/beans xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:scpanhttp://www.springframework.org/schema/contextxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd!-- 会自动扫描com.mc.bsframe下的所有包包括子包下除了Controller的类。 --scpan:component-scan base-packagecom.mc.bsframescpan:exclude-filter typeannotation expressionorg.springframework.stereotype.Controller /scpan:exclude-filter typeannotation expressionorg.springframework.web.bind.annotation.ControllerAdvice //scpan:component-scan!-- Spring中引入其他配置文件 --import resourceclasspath*:/spring/job-timer.xml //beans 二、引入properties文件。
方法1 !--引入数据库配置信息 --context:property-placeholder locationclasspath*:properties/db.properties / 方法2
情况1配置一个 bean idpropertyConfigurer classorg.springframework.beans.factory.config.PropertyPlaceholderConfigurerproperty namelocation valueclasspath*:db/jdbc.properties //bean 情况2配置多个 bean idpropertyConfigure classorg.springframework.beans.factory.config.PropertyPlaceholderConfigurerproperty namelocationslistvalueclasspath:/opt/demo/config/demo-db.properties/value valueclasspath:/opt/demo/config/demo-db2.properties/value /list/property/bean 这些properties中就是key-value的键值对使用的时候可以使用${xxx} 获取。