小编Fel*_*ann的帖子

打包后inStream参数为null

我的 Spring Boot 应用程序出现以下错误:

There was an unexpected error (type=Internal Server Error, status=500).
inStream parameter is null
Run Code Online (Sandbox Code Playgroud)

该应用程序在 IntelliJ 中运行没有错误。打包后.jar.war无法再找到我的属性文件。

 Properties prop = new Properties();
prop.load(WebtvApplication.class.getClassLoader().getResourceAsStream("sender.properties"));
Run Code Online (Sandbox Code Playgroud)

这是我的目录和属性文件的屏幕截图: 这是我的目录和属性文件的屏幕截图

我的 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.2.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>de.felix</groupId>
    <artifactId>webtv</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>webtv</name>
    <description>Demo project for Spring Boot</description>
    <packaging>war</packaging>

    <properties>
        <java.version>11</java.version>
            <start-class>de.felix.webtv.WebtvApplication</start-class>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency> …
Run Code Online (Sandbox Code Playgroud)

java spring location file getresource

5
推荐指数
1
解决办法
2万
查看次数

基于react中的props渲染动态html元素

我有一个组件,它接收一堆值作为 props,其中有一个带有字符串值的 prop,它定义了“要返回的输出 html”的类型。

像这样的东西,这当然是错误的

const WithScrollingText = ({text,boxWidth,tag}) => {
    return boxWidth > 100
    ?   <tag>{text}</tag>
    :   <div className="with-scrolling-text"><div>{text}</div></div>
}
Run Code Online (Sandbox Code Playgroud)

我会像这样调用/使用这个组件:

<WithScrollingText text="Something" boxWidth={250} tag="span"/>
<WithScrollingText text="Something else" boxWidth={250} tag="div"/>
Run Code Online (Sandbox Code Playgroud)

等等

如何修复渲染,以便当我将“span”发送到组件时,它会渲染并返回一个跨度

javascript jsx reactjs

1
推荐指数
1
解决办法
1979
查看次数

标签 统计

file ×1

getresource ×1

java ×1

javascript ×1

jsx ×1

location ×1

reactjs ×1

spring ×1