【发布时间】:2018-10-28 08:15:47
【问题描述】:
我正在尝试将 spring mvc 应用程序转换为 spring boot。我曾经在tomcat中部署这个应用程序并进行测试。现在使用 spring boot 我正在尝试做同样的事情,但我面临加载 xml 文件配置的问题。
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<!-- Data sources -->
<Environment name="/source/schema" value="${schema}" type="java.lang.String" />
<Resource auth="Container" driverClass="org.postgresql.Driver"
factory="org.apache.naming.factory.BeanFactory"
idleConnectionTestPeriod="30" jdbcUrl="${url}"
maxAdministrativeTaskTime="0" maxConnectionAge="30" maxIdleTime="9" maxPoolSize="3" minPoolSize="2"
name="/source/DataSource" password="${password}"
preferredTestQuery="select 1" testConnectionOnCheckout="true" type="com.mchange.v2.c3p0.ComboPooledDataSource" user="${user}"/>
</Context>
这是我正在尝试加载的配置文件。当我把
@ImportResource({"classpath:applicationContext.xml", "classpath:context.xml"})
我能够从 applicationcontext.xml 加载所有 bean 配置,但是在加载 context.xml 时它给出了
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'Context'.
在tomcat中部署spring boot app时应该如何加载这些条目?
【问题讨论】:
标签: spring-mvc spring-boot tomcat8