我目前正在研究J2ME打磨应用程序,只是增强它.我发现很难获得jar文件的确切版本.有没有办法找到在类中进行的导入的jar文件的版本?我的意思是如果你有一些东西,导入xyz; 我们可以知道jar xy包所属的版本吗?
我如何知道Web应用程序的部署环境,例如它是本地的,dev,qa还是prod等.有什么方法可以在运行时在spring应用程序上下文文件中确定这个?
在Spring的applicationcontext.xml文件中使用#{systemProperties ['environment']}是否返回与环境相关的值?
或者有没有办法在spring applicationcontext.xml文件中获取系统变量值.
我需要做些什么特别的事情才能使文本在对齐中对齐<TableLayout>?
下面的简单示例似乎将文本右对齐放在屏幕中央,几乎就像layout_span没有效果一样.
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
>
<TableRow>
<TextView
android:text="Some text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_span="2"
/>
</TableRow>
<TableRow>
<Button
android:text="Button 1"
android:layout_weight="50"/>
<Button
android:text="Button 2"
android:layout_weight="50"/>
</TableRow>
</TableLayout>
Run Code Online (Sandbox Code Playgroud) 我正在使用spring 3.0,hibernate开发webapp.当我尝试在WAS 7.0上部署我的应用程序时,它给出了错误 - 无法加载侦听器:org.springframework.web.context.ContextLoaderListener]:java.lang.ClassNotFoundException:
以下是我的网络应用的外观:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>ABC</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
Run Code Online (Sandbox Code Playgroud)
抛出的异常如下,
com.ibm.ws.webcontainer.webapp.WebApp logError SRVE0293E: [Servlet Error]-[Failed to load listener: org.springframework.web.context.ContextLoaderListener]: java.lang.ClassNotFoundException: class java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at java.beans.Beans.instantiate(Beans.java:190)
at java.beans.Beans.instantiate(Beans.java:75)
at com.ibm.ws.webcontainer.webapp.WebApp.loadListener(WebApp.java:1643)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.loadListener(WebAppImpl.java:671)
at com.ibm.ws.webcontainer.webapp.WebApp.loadLifecycleListeners(WebApp.java:1554)
Run Code Online (Sandbox Code Playgroud)
那么,web.xml中有什么问题吗?
编辑:对不起,我没有提及,我正在使用Maven来获取罐子.我在WEB-INF文件夹中也有所需的jar文件,即org.springframework.web.context
我是Android应用程序开发的新手.刚刚启动了Hello world android应用程序.
我想知道Android应用程序中是否会有任何控制流,比如Struts MVC,Spring MVC等.
我正在努力增强Android应用程序,所以我认为知道控制流程将是一个良好的开端.
我使用mockito作为模拟框架.我在这里有一个scenerio,我的时间(abc.method()).thenReturn(value)不返回值,而是返回null.
这是我的课和测试的样子.
public class foo(){
public boolean method(String userName) throws Exception {
ClassA request = new ClassA();
request.setAbc(userName);
ClassB response = new ClassB();
try {
response = stub.callingmethod(request);
} catch (Exception e) {
}
boolean returnVal = response.isXXX();
return returnVal;
}
Run Code Online (Sandbox Code Playgroud)
现在接下来是测试
@Test
public void testmethod() throws Exception{
//arrange
String userName = "UserName";
ClassA request = new ClassA();
ClassB response = new ClassB();
response.setXXX(true);
when(stub.callingmethod(request)).thenReturn(response);
//act
boolean result = fooinstance.lockLogin(userName);
//assert
assertTrue(result);
}
Run Code Online (Sandbox Code Playgroud)
stub使用mockito进行模拟,即使用@Mock.测试在类foo中抛出NullPointerException,接近boolean retrunVal = response.isXXX();