Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 在Spring前端端点不工作的情况下生成和部署React_Reactjs_Spring_Deployment_Build_Host - Fatal编程技术网

Reactjs 在Spring前端端点不工作的情况下生成和部署React

Reactjs 在Spring前端端点不工作的情况下生成和部署React,reactjs,spring,deployment,build,host,Reactjs,Spring,Deployment,Build,Host,我对包含在前端应用程序(react)中的端点有问题。 首先,我构建前端应用程序,然后在后端应用程序mvn clean install中进行安装,然后运行java-jar.jar 应用程序正在“localhost”中运行,但当我想更改端点时,我得到了以下结果: Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Fri Oc

我对包含在前端应用程序(react)中的端点有问题。 首先,我构建前端应用程序,然后在后端应用程序mvn clean install中进行安装,然后运行java-jar.jar

应用程序正在“localhost”中运行,但当我想更改端点时,我得到了以下结果:

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Oct 09 12:43:58 CEST 2020
There was an unexpected error (type=Not Found, status=404).
App.js 在春季应用中:

POM.xml 我不知道问题是因为代理无法重定向到具有端点的正确主机


你有什么办法解决这个问题吗?

有什么建议吗?
function App() {
  return (
    <>
    <Router>
            <Route exact path="/" component={ChooseApplication}/>
            <Route exact path="/core/register" component={RegisterPage}/>
            <Route exact path="/core/login" component={LoginPage}/>
            <Route exact path="/core/presite" component={Presite}/>
            <Route exact path="/library" component={Library}/>
            <Route exact path="/panel/landing" component={Landing}/>
            <Route exact path="/panel/map" component={MapEndpoint}/>
            <Route exact path="/panel/documents" component={DocumentsEndpoint}/>
    </Router>
    </>
  );
}

export default App;

  "name": "panel",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.11.0",
    "@material-ui/icons": "^4.9.1",
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "axios": "^0.19.2",
    "axios-progress-bar": "^1.2.0",
    "http-proxy-middleware": "^1.0.5",
    "jQuery": "^1.7.4",
    "material-ui": "^0.20.2",
    "ol": "^6.4.2",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-openlayers": "^0.3.0",
    "react-scripts": "3.4.1",
    "styled-components": "^5.2.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "jquery": "^3.5.1",
    "parcel-bundler": "^1.12.4",
    "react-router-dom": "^5.2.0"
  },
  "devServer": {
    "proxy": {
      "/panel/*": {
        "target": "http://[::1]:8080"
      }
    }
  }
}
<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.6</version>
                <configuration>
                    <workingDirectory>admin_panel_front</workingDirectory>
                    <installDirectory>target</installDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v8.9.4</nodeVersion>
                            <npmVersion>5.6.0</npmVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm install</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>install</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm run build</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <configuration>
                            <target>
                                <copy todir="${project.build.directory}/classes/public">
                                    <fileset dir="${project.basedir}/admin_panel_front/build"/>
                                </copy>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
server.port=80