我试图将JsonNode存储到我的spring jdbc会话中,
而当数据设置好并准备好在spring中插入数据库时,则抛出ConversionFailedException.
我尝试了下面提到的相同,但是没有工作.
没有找到能够从类型java.lang.Object转换为JdbcOperationsSessionRepository中的byte []类型的转换器.
我也查看了JdbcHttpSessionConfiguration,看起来代码已经存在.
@EnableJdbcHttpSession(maxInactiveIntervalInSeconds = 1800)
public class MyConfiguration extends WebMvcConfigurerAdapter {
}
// session class
@Component
@Scope(value = SCOPE_SESSION, proxyMode = TARGET_CLASS)
public class SessionForm implements Serializable {
private String someOtherFeild;
private JsonNode custom;
....
}
org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.Object] to type [byte[]] for value 'com.rakuten.payment.step.app.step.model.session.SessionForm@e943f2d'; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: com.fasterxml.jackson.databind.node.ObjectNode
at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:43)
at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:203)
at org.springframework.session.jdbc.JdbcOperationsSessionRepository.serialize(JdbcOperationsSessionRepository.java:627)
at org.springframework.session.jdbc.JdbcOperationsSessionRepository.access$400(JdbcOperationsSessionRepository.java:129) …Run Code Online (Sandbox Code Playgroud) My vue page have a photo gallery, and when a photo is selected, the dialog will jump out by setting the selectedCard.
虽然图像不适合屏幕的大小。
我试图将 css 设置为最大高度或宽度为 100%,但它们都不起作用。
如何修复我的 css 以便可以在屏幕上查看整个图像而无需滚动?
屏幕截图:只能显示一半的图像
//Dialog component
<template>
<v-dialog :value="selectedCard" scrollable fullscreen hide-overlay>
<v-card v-if="selectedCard">
<v-container grid-list-sm fluid>
<v-layout align-space-around row fill-height>
<v-flex id="mainCardPanel">
<v-layout align-space-around column fill-height>
<v-flex xs12>
<MyCard class="mainCard" :card="selectedCard"></MyCard>
</v-flex>
<v-flex xs12>
<v-btn> SomeButton </v-btn>
</v-flex>
</v-layout>
</v-flex>
</v-layout>
</v-container>
</v-card>
</v-dialog>
</template>
// MyCard component
<template>
<v-card flat …Run Code Online (Sandbox Code Playgroud) 我有一个spring boot应用程序,控制器将根据post参数重定向到页面。
我正在创建要断言重定向页面的测试用例,但是我无法从放心的响应中获取重定向的html
@Test
public void test() throws Exception {
Response response = given()
.param("name", "myName")
.when()
.redirects().follow(true).redirects().max(100)
.post("/myPath"); // it will redirect to another page
// I want to print from <html> to </html> of the redirected page
System.out.println("returned full html /n" + response.getBody().asString());
}
Run Code Online (Sandbox Code Playgroud)
我收到302以及重定向页在响应标头中的位置。
11:38:03.291 [main] DEBUG org.apache.http.headers - << "Location: http://localhost:8080/myRedirectPage[\r][\n]"
.........
11:38:03.291 [main] DEBUG org.apache.http.impl.conn.DefaultClientConnection - Receiving response: HTTP/1.1 302
11:38:03.291 [main] DEBUG org.apache.http.headers - << HTTP/1.1 302
Run Code Online (Sandbox Code Playgroud) 在我的项目,图像文件夹根据图像名称,而不是显示
绘制drawbale -华电国际drawbale-MDPI drawbale-xdpi drawbale-xxdpi
我在创建新项目的大部分教程中看到了文件夹,
我只是按照启动我的新项目而不更改任何设置.
我需要更改一些设置吗?

我在尝试使用csvreader时遇到了java.lang.NoClassDefFoundError的错误
在项目中,我将opencsv-3.2.jar放在libs文件夹
和gradle中,
compile files ('libs/opencsv-3.2.jar')
Run Code Online (Sandbox Code Playgroud)
在依赖项中添加
对于我的csv文件,它放在src/main/assests/data.csv中
在我的代码中:
AssetManager assetManager = context.getAssets();
try {
InputStream csvStream = assetManager.open("data.csv");
InputStreamReader csvStreamReader = new InputStreamReader(csvStream);
CSVReader csvReader = new CSVReader(csvStreamReader);
String [] nextLine;
Log.d("test","reading csv");
// error in following sentence
while ((nextLine = csvReader.readNext()) != null) {
// nextLine[] is an array of values from the line
Log.d("test",nextLine.toString() + "etc...");
break;
}
} catch (FileNotFoundException e) {
Log.d("test","fail read csv");
e.printStackTrace();
} catch (IOException e) {
Log.d("test","io exception csv");
e.printStackTrace();
}` …Run Code Online (Sandbox Code Playgroud) 我正在尝试学习并从 7 切换到 Java 8。
虽然我在切换 Arrays.sort 时遇到了问题,这给了我的错误:类型不适用。
我知道有一些更好的方法可以完成相同的任务,但我想使用相同的功能来更好地理解。
提前致谢。
package src;
import java.util.Arrays;
import java.util.Comparator;
public class Java8Learning {
public static void main(String[] args){
Integer[] numbers = {4,5,3,2,6,1};
-------java 7 ---------
Arrays.sort(numbers, new Comparator<Integer>() {
@Override
public int compare(Integer firstNumber, Integer secondNumber){
System.out.print("comparing :"+ firstNumber + " and " + secondNumber);
return Integer.compare(firstNumber, secondNumber);
}
});
-------java 8 ---------
// it gave me error
//The method sort(T[], Comparator<? super T>) in the type Arrays is not applicable for the …Run Code Online (Sandbox Code Playgroud)