xml Java的:春季:CONFIG.XML

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml Java的:春季:CONFIG.XML相关的知识,希望对你有一定的参考价值。

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:jdbc="http://www.springframework.org/schema/jdbc"
       xsi:schemaLocation="http://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 http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
    <context:property-placeholder location="META-INF/jdbc-test.properties"/>

    <!-- Scans within the base package of the application for @Component classes to configure as beans -->
    <context:component-scan base-package="au.com.rds.rdsc.datafetcher"/>

    <!--<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">-->
        <!--<property name="driverClassName" value="${jdbc.driverClassName}"/>-->
        <!--<property name="url" value="${jdbc.url}"/>-->
        <!--<property name="username" value="${jdbc.username}"/>-->
        <!--<property name="password" value="${jdbc.password}"/>-->
    <!--</bean>-->

    <jdbc:embedded-database id="dataSource" type="H2">
        <jdbc:script location="classpath:META-INF/test-schema.sql"/>
        <jdbc:script location="classpath:META-INF/test-data.sql"/>
    </jdbc:embedded-database>

    <bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
        <property name="dataSource" ref="dataSource"/>
    </bean>

    <tx:annotation-driven transaction-manager="txManager"/>

</beans>
<context:property-placeholder location="classpath*:walaps-public.properties, classpath*:META-INF/spring/*.properties"/>

<context:spring-configured/>

<context:component-scan base-package="au.com.rds.doc, au.gov.nt.dlrm, au.com.rds">
    <context:exclude-filter type="regex" expression="au\.com\.rds\.spring\.testing\..*"/>
</context:component-scan>

<!-- The controllers are autodetected POJOs labeled with the @Controller annotation. -->
<context:component-scan base-package="au.gov.nt.dlrm" use-default-filters="false">
    <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>

<jpa:repositories base-package="au.gov.nt.dlrm, au.com.rds" repository-impl-postfix="CustomImpl"/>

<!-- The following group of beans are the expansion of the mvc:annotation-driven tag. They turn on support for mapping requests to Spring MVC @Controller methods 
and also register Formatters and Validators for use across all @Controllers. The tag has been expanded so can specify interceptors on @Controller annotated controllers 
only. Note that the applicationConversionService bean referenced here is not defined in this file and needs to be defined by the containing app. -->
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping">
    <property name="order" value="0" />
    <property name="interceptors">
        <list>
            <!-- RecordingSimpleMappingExceptionResolver catches exceptions thrown by handlers, so any errors that propagate here will be be from the view processing. -->
            <bean class="au.com.rds.spring.mvc.exception.RecordingExceptionInterceptor" />
            <bean class="au.com.rds.spring.mvc.messages.CopyGlobalErrorsToMessagesInterceptor" />
            <bean class="au.com.rds.spring.validation.ValidatorFactorySetupInterceptor" />
            <ref bean="conversionServiceExposingInterceptor" />
            <!-- Add version info from the META-INF/version.properties file to each request -->
            <ref bean="versionInfoInterceptor" />
            <!-- Places messages in a flash map for preserving messages across a redirect, (Fine in this instance as the webapp will be running in one vm) -->
            <ref bean="messagesPreservingRedirectInterceptor" />
        </list>
    </property>
</bean>

<bean class="au.com.rds.spring.mvc.request.RdsRequestMappingHandlerAdapter">
    <property name="webBindingInitializer">
        <bean class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer">
            <property name="conversionService" ref="applicationConversionService" />
            <property name="validator" ref="validator" />
        </bean>
    </property>
    <property name="messageConverters">
        <list>
            <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" />
            <bean class="org.springframework.http.converter.StringHttpMessageConverter" />
            <bean class="org.springframework.http.converter.FormHttpMessageConverter" />
            <bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter" />
            <bean id="jsonConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
                <property name="supportedMediaTypes" value="application/json" />
            </bean>
        </list>
    </property>
</bean>

<!-- Allows for mapping the DispatcherServlet to "/" by forwarding static resource requests to the container's default Servlet. Note that this must occur AFTER 
all other handler mappings. -->
<mvc:default-servlet-handler />

<!-- register "global" interceptor beans to apply to all registered HandlerMappings -->
<mvc:interceptors>
    <bean class="org.springframework.web.servlet.theme.ThemeChangeInterceptor" />
    <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" p:paramName="lang" />
</mvc:interceptors>

<!-- Activiti -->
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="dataSource" ref="dataSource"/>
    <property name="transactionManager" ref="transactionManager"/>
    <property name="databaseSchemaUpdate" value="true"/>
    <property name="jobExecutorActivate" value="false"/>
    <property name="deploymentResources" value="classpath*:/activiti/*.bpmn" />
    <property name="deploymentMode" value="single-resource" />

    <property name="history" value="full" />

    <property name="mailServerHost" value="smtp.gmail.com" />
    <property name="mailServerPort" value="587" />
    <property name="mailServerDefaultFrom" value="test@relational.com.au" />
    <property name="mailServerUsername" value="wms.poc@gmail.com" />
    <property name="mailServerPassword" value="show.me.the.money" />
    <property name="mailServerUseSSL" value="true" />
    <property name="mailServerUseTLS" value="true" />
</bean>

<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
    <property name="processEngineConfiguration" ref="processEngineConfiguration"/>
</bean>

<bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService"/>
<bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService"/>
<bean id="taskService" factory-bean="processEngine" factory-method="getTaskService"/>
<bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService"/>
<bean id="managementService" factory-bean="processEngine" factory-method="getManagementService"/>
<bean id="formService" factory-bean="processEngine" factory-method="getFormService"/>
<!-- End Activiti -->

以上是关于xml Java的:春季:CONFIG.XML的主要内容,如果未能解决你的问题,请参考以下文章

java mybatis-config.xml 配置文件顺序

java开发时maven配置config.xml

Mybatis学习XML配置文件之mybatis-config.xml

嵌套异常是 java.io.FileNotFoundException:类路径资源 [my-config.xml] 无法打开,因为它不存在

运行 Web 服务客户端和代理时出错,严重:JDeveloper 12c 中的 java.io.FileNotFoundException: ./config/jps-config.xml

编写javaweb用到的基本依赖,mybatis-config.xml代码,SqlSessionFactoryUtils.java