我是Spring的新手,我想用Velocity进行设置.因此,我在Eclipse Kepler中使用Spring Tool Suite Extension创建了一个新的Spring项目,一个新的Spring MVC项目.然后我添加org.apache.velocity了1.7版本的新Spring项目.之后我servlet-context.xml根据http://docs.spring.io/spring/docs/3.2.x/javadoc-api/org/springframework/web/servlet/view/velocity/VelocityConfigurer.html向我添加了以下几行.
<beans:bean id="velocityConfig"
class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
<beans:property name="resourceLoaderPath" value="/WEB-INF/views/" />
</beans:bean>
<!-- View resolvers can also be configured with ResourceBundles or XML files.
If you need different view resolving based on Locale, you have to use the
resource bundle resolver. -->
<beans:bean id="viewResolver"
class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
<beans:property name="cache" value="true" />
<beans:property name="prefix" value="" />
<beans:property name="suffix" value=".jsp" />
</beans:bean>
Run Code Online (Sandbox Code Playgroud)
一切都很好.但是如果我将pom.xml中Springframework的版本从3.1.1.RELEASE更改为3.2.4.RELEASE,我会在Eclipse中显示以下错误:
No setter found for property 'resourceLoaderPath' in class 'org.springframework.web.servlet.view.velocity.VelocityConfigurer'
Run Code Online (Sandbox Code Playgroud)
我甚至用Ubuntu建立了一个新的虚拟机来测试它 - 我到处都得到同样的错误.你需要我的更多文件吗?
mvn依赖的输出:树在我看来看起来并不可疑,是吗? …
我对 numpy 的索引有点困惑。假设以下示例:
>>> import numpy as np
>>> x = np.arange(10)
>>> x.shape = (2,5)
>>> x
array([[0, 1, 2, 3, 4],
[5, 6, 7, 8, 9]])
>>> x[0:-1]
array([[0, 1, 2, 3, 4]])
>>> x[1:-1]
array([], shape=(0, 5), dtype=int64)
>>> x[1:]
array([[5, 6, 7, 8, 9]])
Run Code Online (Sandbox Code Playgroud)
我感到困惑的是,我可以使用x[0:-1]. 但-1就指数而言,实际上意味着什么?我会想,那个调用x[1:-1]会给我第二行,但是如果返回一个空数组,并且得到我想要的我需要使用 x[1:]?
我有点困惑。谢谢您的帮助
我会用PhpUnit创建一些测试.但我想测试的php文件使用mt_rand()函数.那么如何创建一个知道mt_rand()返回值的测试呢?感谢您回答我的问题并抱歉我的英语不好,我来自德国;)