首页 > 其他分享 >spring-xml文件头

spring-xml文件头

时间:2024-05-23 09:51:19浏览次数:10  
标签:xml lang jdbc 文件 spring beans

1.beans

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd">

</beans>

2.context

<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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        https://www.springframework.org/schema/context/spring-context.xsd">
    <context:annotation-config/>
</beans>

3.p

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:p="http://www.springframework.org/schema/p"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    https://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close"
        p:driverClassName="com.mysql.jdbc.Driver"
        p:url="jdbc:mysql://localhost:3306/mydb"
        p:username="root"
        p:password="misterkaoli"/>

</beans>

4.c

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:c="http://www.springframework.org/schema/c"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="beanTwo" class="x.y.ThingTwo"/>
    <bean id="beanThree" class="x.y.ThingThree"/>

    <!-- traditional declaration with optional argument names -->
    <bean id="beanOne" class="x.y.ThingOne">
        <constructor-arg name="thingTwo" ref="beanTwo"/>
        <constructor-arg name="thingThree" ref="beanThree"/>
        <constructor-arg name="email" value="[email protected]"/>
    </bean>

    <!-- c-namespace declaration with argument names -->
    <bean id="beanOne" class="x.y.ThingOne" c:thingTwo-ref="beanTwo"
        c:thingThree-ref="beanThree" c:email="[email protected]"/>

</beans>

5.apo

<?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:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/aop
        https://www.springframework.org/schema/aop/spring-aop.xsd">

    <!-- an HTTP Session-scoped bean exposed as a proxy -->
    <bean id="userPreferences" class="com.something.UserPreferences" scope="session">
        <!-- instructs the container to proxy the surrounding bean -->
        <aop:scoped-proxy/> 
    </bean>

    <!-- a singleton-scoped bean injected with a proxy to the above bean -->
    <bean id="userService" class="com.something.SimpleUserService">
        <!-- a reference to the proxied userPreferences bean -->
        <property name="userPreferences" ref="userPreferences"/>
    </bean>
</beans>

6.lang

<?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:lang="http://www.springframework.org/schema/lang"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
        https://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/lang
        https://www.springframework.org/schema/lang/spring-lang.xsd">

    <lang:groovy id="messenger"
            script-source="classpath:org/springframework/scripting/groovy/Messenger.groovy">
        <lang:property name="message" value="Fiona Apple Is Just So Dreamy."/>
    </lang:groovy>

    <!--
    when the above bean (messenger) is instantiated, this custom
    BeanPostProcessor implementation will output the fact to the system console
    -->
    <bean class="scripting.InstantiationTracingBeanPostProcessor"/>

</beans>

7.jdbc

<beans profile="development"
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc"
    xsi:schemaLocation="...">

    <jdbc:embedded-database id="dataSource">
        <jdbc:script location="classpath:com/bank/config/sql/schema.sql"/>
        <jdbc:script location="classpath:com/bank/config/sql/test-data.sql"/>
    </jdbc:embedded-database>
</beans>

标签:xml,lang,jdbc,文件,spring,beans
From: https://www.cnblogs.com/ccblblog/p/18207675

相关文章

  • 防止内部泄密:掌握文件夹加密的五大关键步骤
    在数字化办公成为常态的今天,企业内部数据的安全保护变得尤为重要。内部泄密不仅会导致商业机密的外泄,还可能对企业的声誉和经济利益造成严重损害。因此,采取有效的文件夹加密措施,是确保数据安全的关键。以下是防止内部泄密,实施文件夹加密的五大关键步骤:步骤一:数据分类与风险评估......
  • 讲一下什么是Spring
    Spring是一个轻量级的IoC和AOP容器框架。是为Java应用程序提供基础性服务的一套框架,目的是用于简化企业应用程序的开发,它使得开发者只需要关心业务需求。常见的配置方式有三种:基于XML的配置、基于注解的配置、基于Java的配置。主要由以下几个模块组成:SpringCore:核心类库,提供I......
  • 如何保障经销商收发文件的安全性及高效性?
    经销商在商业运作中会与多种角色进行文件数据的传输来往,比如客户、供应商等,因此经销商收发文件需要确保文件的安全性、准确性和及时性,这对于经销商的业务运营至关重要。经常遇到的经销商收发文件场景:供应商:经销商需要与供应商交换产品信息、订单详情、库存状态、采购合同等文件......
  • Spring框架中都用到了哪些设计模式?
    这是一道相对有难度的题目,你不仅要回设计模式,还要知道每个设计模式在Spring中是如何使用的。简单工厂模式:Spring中的BeanFactory就是简单工厂模式的体现。根据传入一个唯一的标识来获得Bean对象,但是在传入参数后创建还是传入参数前创建,要根据具体情况来定。工厂模式:Spring......
  • [os] xx.serive文件编写 -- systemctl
    [os]  xx.serive文件编写--systemctl    一、基本信息 1、操作系统:Linuxrocky5.14.0-427.16.1.el9_4.x86_64#1SMPPREEMPT_DYNAMICWedMay817:48:14UTC2024x86_64x86_64x86_64GNU/Linux   二、c语言程序可运行文件(systest) ......
  • Windows中实现将bat或exe文件作为服务_且实现命令行安装、配置、启动、删除服务
    一、背景描述在Windows环境下进行日常的项目开发过程中,有时候需要将bat文件或exe文件程序注册为Windows的服务实现开机自己运行(没有用户登陆,服务在开机后也可以照常运行)、且对于那些没有用户交互界面的exe程序来说只要在后台运行即可,无需在桌面显示该exe程序窗口内容、无......
  • Spring6日志
    JakartaCommonsLoggingAPI是一种Java日志记录抽象层,它允许开发者在运行时插入所需的日志框架,如Log4j、JavaUtilLogging、SLF4J等。该API提供了一个简单的日志记录接口,使得开发者无需关心底层使用的具体日志框架。使用JakartaCommonsLoggingAPI的好处包括:灵......
  • Spring Boot —— Spring Security
    引入依赖Springboot版本2.7.6<properties><java.version>1.8</java.version><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><project.reporting.outputEncoding>UTF-8</project.repo......
  • 记录一个按列内容拆分Excel文件的小方法
    importtkinterastkimportosimporttkinter.filedialogimporttkinter.simpledialogimportpandasaspdimporttkinter.messageboximporttkinter.ttkimporttracebackglobalcolumn,sheet_origlobalcombox_2#按内容分类defsplit_by_group():#获取需......
  • 记录一个批量压缩文件夹的方法
    importosimportzipfilefromtkinterimportfiledialogclassZipDir:"""ZipFile()用于创建1个zip文件对象,示例中的三个参数分别表示:filename:压缩成的zip包的路径(含压缩包名称);例如:xxx.zipmode:可选r,w,a,代表不同的打开文件的方式;r只读;w重写;a添加......