Spring配置文件模版
每次写application.xml时,头部有一大堆需要重复书写的声明内容,本人的记忆力根本Hold不住。虽然该内容有很重要的意义,但大多数时候只需要copy。有必要单独分离出一个“可运行”的template,写的时候可以毫无顾忌地直接copy,然后迅速地专注于主体配置的书写。这里顺带一个String类型的测试Bean,只要spring容器初始化成功并且加载了该配置文件,该bean不需要额外的包(当然因为是String类型)一定能获取。所以如果运行出Bug了,也可以用来 测试究竟是你的代码不工作了还是spring容器出问题了。<?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:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd "> <bean id="testStr" class="java.lang.String"> <constructor-arg> <value>Hello,Spring!</value> </constructor-arg> </bean> </beans>所谓的“有很重要的意义”。。。
原文地址:https://www.jb51.cc/xml/297502.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。