使用Spring Boot devtools 1.3解决了新的LiveReload功能问题.它不会在类更改时重新加载.我已经看到它使用IntelliJ @ Devoxx 2015进行了演示.是否需要启用一些IDE设置?我正在通过IDE运行,而不是通过Gradle运行.我尝试启用"自动生成项目",这似乎没有帮助.
它似乎正确加载并正在寻找正确的路径
2015-11-23 05:55:30.592 DEBUG 4700 --- [ restartedMain] o.s.boot.devtools.restart.Restarter : Starting application com.myapp.Application with URLs [file:/E:/Projects/myapp/build/classes/main/, file:/E:/Projects/myapp/build/resources/main/]
Run Code Online (Sandbox Code Playgroud)
我的文件
的build.gradle
buildscript {
ext {
springBootVersion = '1.3.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'idea'
apply plugin: 'spring-boot'
apply plugin: 'war'
war {
baseName = 'myapp'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" …Run Code Online (Sandbox Code Playgroud) 我似乎无法克服这个问题.我正在尝试模拟一个带有1个参数的重载方法
class ClassWithOverloadedMethod {
private boolean isValid(ClassA a){
return true;
}
private boolean isValid(ClassB B){
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
模拟设置
ClassWithOverloadedMethod uut = PowerMockito.spy(new ClassWithOverloadedMethod());
PowerMockito.doReturn(true).when(uut, "isValid", Matchers.isA(ClassB.class));
Run Code Online (Sandbox Code Playgroud)
但PowerMockito继续返回此错误
java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at org.powermock.reflect.internal.WhiteboxImpl.checkIfParameterTypesAreSame(WhiteboxImpl.java:2432)
at org.powermock.reflect.internal.WhiteboxImpl.getMethods(WhiteboxImpl.java:1934)
at org.powermock.reflect.internal.WhiteboxImpl.getBestMethodCandidate(WhiteboxImpl.java:1025)
at org.powermock.reflect.internal.WhiteboxImpl.findMethodOrThrowException(WhiteboxImpl.java:948)
at org.powermock.reflect.internal.WhiteboxImpl.doInvokeMethod(WhiteboxImpl.java:882)
at org.powermock.reflect.internal.WhiteboxImpl.invokeMethod(WhiteboxImpl.java:713)
at org.powermock.reflect.Whitebox.invokeMethod(Whitebox.java:401)
at org.powermock.api.mockito.internal.expectation.PowerMockitoStubberImpl.when(PowerMockitoStubberImpl.java:93)
Run Code Online (Sandbox Code Playgroud)
我正在使用PowerMockito 1.5和Mockito 1.9.5
我在Windows 7上使用带有Java 7(1.7.0_71)64位的iText版本5.5.6(也测试了5.3.4)
这是一个示例代码
@Test
public void testConvert() throws Exception {
try{
//Read the Tiff File
RandomAccessFileOrArray myTiffFile=new RandomAccessFileOrArray("C:\\local\\docs\\test.01.tif");
//Find number of images in Tiff file
int numberOfPages= TiffImage.getNumberOfPages(myTiffFile);
System.out.println("Number of Images in Tiff File: " + numberOfPages);
Document TifftoPDF=new Document();
PdfWriter.getInstance(TifftoPDF, new FileOutputStream("C:\\local\\docs\\test.01.pdf"));
TifftoPDF.open();
//Run a for loop to extract images from Tiff file
//into a Image object and add to PDF recursively
for(int i=1;i<=numberOfPages;i++){
//*******
//******* this next line is generating the error
//*******
Image tempImage=TiffImage.getTiffImage(myTiffFile, i);
TifftoPDF.add(tempImage); …Run Code Online (Sandbox Code Playgroud)