我的React应用程序中的背景图片没有显示!
我已通过以下方式将其应用于index.html文件:
public class MyRedisCacheManager extends RedisCacheManager
{
private RedisSerializer redisSerializer;
public MyRedisCacheManager(RedisTemplate<?, ?> redisTemplate)
{
super( redisTemplate );
//Create the key serializer
Jackson2JsonRedisSerializer<Object> jKeySerializer = new Jackson2JsonRedisSerializer<>( Object.class );
ObjectMapper keyObjectMapper = new ObjectMapper();
keyObjectMapper.setVisibility( PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY );
keyObjectMapper.enableDefaultTyping( ObjectMapper.DefaultTyping.NON_FINAL );
//Set on our key serializer
jKeySerializer.setObjectMapper( keyObjectMapper );
//Save on the template (which is used to communicate with Redis)
redisTemplate.setKeySerializer( jKeySerializer );
}
}
但是,出现以下错误:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>React and Webpack4</title>
<style type="text/css">
body {
background: url("background.png");
background-size: cover;
height: 100%;
width: 100%; /* For flexibility */
}
</style>
</head>
<body>
<section id="index"></section>
</body>
</html>