我有一个运行良好的 Web 应用程序。现在我正在尝试为其编写单元测试。我的网络应用程序有以下 conversionService
<bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
<property name="converters">
<list>
<bean class="....Class1ToStringConverter"/>
<bean class="....StringToClass1Converter"/>
</list>
</property>
</bean>
<mvc:annotation-driven conversion-service="conversionService" />
Run Code Online (Sandbox Code Playgroud)
这很好用,当我提出请求时
/somepath/{class1-object-string-representation}/xx
Run Code Online (Sandbox Code Playgroud)
一切都按预期工作(字符串被解释为 Class1 对象)。
我的问题是尝试向我的控制器编写单元测试。conversionService 只是没有使用,spring 只是告诉我
Cannot convert value of type [java.lang.String] to required type [Class1]: no matching editors or conversion strategy found
Run Code Online (Sandbox Code Playgroud)
到目前为止我的测试:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"file:src/main/webapp/WEB-INF/applicationContext.xml", "file:src/main/webapp/WEB-INF/jpm-servlet.xml"})
@WebAppConfiguration()
public class GeneralTest {
@Autowired
private WebApplicationContext ctx;
private MockMvc mockMvc;
private TestDAO testDAO = org.mockito.Mockito.mock(TestDAO.class);
@Before
public void setUp() throws Exception {
Mockito.reset(testDAO);
mockMvc = MockMvcBuilders.webAppContextSetup(ctx).build();
} …Run Code Online (Sandbox Code Playgroud) 升级到 Java 11 后,我的 PDF 生成停止工作(使用 Apache FOP),并出现以下错误。
Caused by: jakarta.xml.bind.JAXBException: ClassCastException: attempting to cast
jar:file:jakarta.xml.bind-api-3.0.0.jar!/jakarta/xml/bind/JAXBContext.class to
jar:file:jakarta.xml.bind-api-3.0.0.jar!/jakarta/xml/bind/JAXBContext.class.
Please make sure that you are specifying the proper ClassLoader.
Run Code Online (Sandbox Code Playgroud)
这根本没有意义,因为它是同一个文件。以前的问题在迁移到雅加达时得到了解决,但这仍然存在。
我需要为i = 0到N循环做一个经典,怎么能在xstl 1.0中完成?
谢谢.
<xsl:for-each select="¿¿¿$i=0..5???">
<fo:block>
<xsl:value-of select="$i"/>
</fo:block>
</xsl:for-each>
Run Code Online (Sandbox Code Playgroud)
举个例子,我有
<foo>
<bar>Hey!</bar>
</foo>
Run Code Online (Sandbox Code Playgroud)
并希望输出
Hey!
Hey!
Run Code Online (Sandbox Code Playgroud) java ×2
apache-fop ×1
java-11 ×1
jaxb ×1
junit4 ×1
mockito ×1
spring ×1
spring-mvc ×1
xslt ×1
xslt-1.0 ×1