在这一行找到多个注释: - 找不到类 'org.springframework.ui.velocity.VelocityEngineFactoryBean' - 找不到类 'org.springframework.ui.velocity.VelocityEngineFactoryBean' [配置集:MyApp/web-context]
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="velocityProperties">
<value>
resource.loader=class
class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
</value>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
Spring 已将 Velocity 包org.springframework.ui.velocity标记为在Spring 4.3 中已弃用,并在Spring 5.0.1中将其完全删除(根据 Jürgen Höller 的说法,这是因为 Velocity Framework “可追溯到 2010 年”)。
来源:https : //jira.spring.io/browse/SPR-13795。
但是,您仍然可以在 Spring 5.0.x 框架中使用 Velocity 1.7。
只需在此线程中遵循@bekce 的答案即可。
正如 VelocityEngineUtils 中提到的那样,它已在 Spring 3.2 中删除,那么还能使用什么呢?你需要有速度依赖性:
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
对于 XML 配置,将已弃用的 VelocityEngineFactoryBean 替换为 VelocityEngine:
<util:properties id="velocityProperties">
<prop key="resource.loader">class</prop>
<prop key="class.resource.loader.class">org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader</prop>
</util:properties>
<bean id="velocityEngine" class="org.apache.velocity.app.VelocityEngine">
<constructor-arg ref="velocityProperties">
</bean>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11152 次 |
| 最近记录: |