快速生成xml文件:
1、File-Setting-Editer-File and Code Templates-
记得勾选上:Enable Live Templates
2、到spring官网复制xml头部:
https://docs.spring.io/spring/docs/5.0.8.RELEASE/spring-framework-reference/core.html#spring-core
`<?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
http://www.springframework.org/schema/beans/spring-beans.xsd">
<bean id="..." class="...">
<!-- collaborators and configuration for this bean go here -->
</bean>
<bean id="..." class="...">
<!-- collaborators and configuration for this bean go here -->
</bean>
<!-- more bean definitions go here -->
</beans>
注意:当你定义xmlns时,要在xsi:schemaLocation中对应的传入该类本身和spring版本。否则会报错缺少该类。如:缺少了context和context/spring-context.xsd,运行的时候会报错缺少bean。
3、新建xml,选择刚才的“xml”模板,就可以生成xml默认头了。