似乎这个世界的问题,但我仍然无法找到解决方案..
我正在尝试进行简单的测试:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"/applicationContext.xml", "/PersonsPopulateTest-context.xml"})
@Transactional
public class PersonsPopulateTest {
Run Code Online (Sandbox Code Playgroud)
文件位于:
src
main
resources
applicationContext.xml
Run Code Online (Sandbox Code Playgroud)
和
src
test
resources
PersonsPopulateTest-context.xml
Run Code Online (Sandbox Code Playgroud)
因此,在构建这些文件之后,目标/类和目标/测试类
但是mvn test命令仍然说:无法加载ApplicationContext
官方文件说什么:
@RunWith(SpringJUnit4ClassRunner.class)
// ApplicationContext will be loaded from "/applicationContext.xml" and "/applicationContext-test.xml"
// in the root of the classpath
@ContextConfiguration(locations={"/applicationContext.xml", "/applicationContext-test.xml"})
public class MyTest {
// class body...
}
Run Code Online (Sandbox Code Playgroud)
我哪里做错了?
谢谢,Vlaidimir
UPDATE.神火的报告:
java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:157)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:290) …
Run Code Online (Sandbox Code Playgroud) 这两个约束有什么区别?
来自文档:
PUSH - 使组件所在的行和/或列以"重量"增长
GROW - 设置组件相对于同一单元中的其他组件的增长程度.
那么,主要思想是缩小组件内外的大小?
除Chrome以外的所有浏览器都会显示以下样式
.my-checkbox {
width: 20px;
height:20px;
color:#fff;
-moz-appearance:none;
-webkit-appearance:none;
-o-appearance:none;
border: 0px inset ThreeDFace ! important;
margin: 5px;
padding: 5px;
}
Run Code Online (Sandbox Code Playgroud)
这种方法在Chrome中可行吗?
ArrayList描述为
public class ArrayList<E> extends AbstractList<E>
implements List<E>, RandomAccess, Cloneable, java.io.Serializable
Run Code Online (Sandbox Code Playgroud)
而且大多数主要方法都适用于E泛型类型(get,set,add,addAll等)。
但是方法contains,indexOf,lastIndexOf和remove将对象类型作为参数-这仅是由于内部使用或Object.equals()或其他原因吗?
有没有什么聪明的方法可以减少"等于"异常的记录?
例如:
java.lang.IllegalArgumentException: Wrong parameter, should be a float from 0 to 100
at com.test.Foo.setAmount(Foo.java:93)
at com.test.Bar.setAmounts(Bar.java:39)
at com.test.Bar2.init(Bar2.java:152)
at java.awt.event.InvocationEvent.dispatch(Unknown Source) [na:1.7.0_65]
at java.awt.EventQueue.dispatchEventImpl(Unknown Source) [na:1.7.0_65]
at java.awt.EventQueue.access$200(Unknown Source) [na:1.7.0_65]
at java.awt.EventQueue$3.run(Unknown Source) [na:1.7.0_65]
at java.awt.EventQueue$3.run(Unknown Source) [na:1.7.0_65]
at java.security.AccessController.doPrivileged(Native Method) [na:1.7.0_65]
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) [na:1.7.0_65]
at java.awt.EventQueue.dispatchEvent(Unknown Source) [na:1.7.0_65]
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [na:1.7.0_65]
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [na:1.7.0_65]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [na:1.7.0_65]
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [na:1.7.0_65]
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [na:1.7.0_65]
at java.awt.EventDispatchThread.run(Unknown Source) [na:1.7.0_65]
Run Code Online (Sandbox Code Playgroud)
在特定情况下,这种异常可以每秒抛出90次.我们使用AWT处理程序来记录异常,它可以"冻结"所有Swing的应用程序.
我想到的第一个解决方法是在不同的线程中记录异常,但是这样的approch在以后的调试中可能是一个真正的地狱.
第二个想法是将异常放在WeakHashMap中,并仅在第一次出现时记录异常.我不知道如何执行异常等于是否足够快.
我有几个输入:
<input name="row.type[0].value">
<input name="row.type[1].value">
....
<input name="row.type[100].value">
Run Code Online (Sandbox Code Playgroud)
如何获得包含所有这些输入的数组?
如果使用$$ - 操作,那么类似的东西不起作用:
var cabins = $$('input[name^=row.type[].value]').each(function(row) {
//stuff
});
Run Code Online (Sandbox Code Playgroud) 我有3个班:
public class SomeDAO {
// that method I'd want to catch and change
public void getObj() { ... }
}
public class MainService {
private Service2 service2;
public void doMain() {
service2.doSomethingAnother();
}
}
public class Service2 {
private SomeDAO someDAO
public void doSomethingAnother() {
someDAO.getObj();
}
}
Run Code Online (Sandbox Code Playgroud)
我所需要的-调用doMain时而是使用自定义someDao.getObj()内service2.doSomethingAnother() :
public TestClass {
@InjectMocks
private final MainService mainService = new MainService();
@InjectMocks
private final Service2 service2 = new Service2();
@Mock
private SomeDAO someDao;
@Test …
Run Code Online (Sandbox Code Playgroud)