Jhipster 应用程序首先出错 运行

Jhipster application error first run

成功生成新的 Jshipster 3 应用程序后,我无法使用 gulp serve 为应用程序提供服务。

我正在使用 Ubuntu 16.04 和 npm 3.9,当我尝试 运行 gulp serve 时,出现此错误:

enter image description here

当我访问 http://localhost:9000/ 时,我在浏览器上收到以下消息:

    Error: connect ECONNREFUSED 127.0.0.1:8080
   at Object.exports._errnoException (util.js:870:11)
   at exports._exceptionWithHostPort (util.js:893:20)
   at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)

有什么建议吗? :(

错误说 gulp 无法连接到 127.0.0.1:8080 地址上的后端 ,这很可能意味着您还没有启动后端.

您应该使用 mvn spring-boot:runmvn 命令启动 Spring 应用程序,这会在 http://localhost:8080地址。

在此处阅读更多内容:https://jhipster.github.io/development/

添加@ComponentScan注解和基础包名

@ComponentScan(basePackages={"com.example"})

见下面的代码。

package com.example.SampleProject;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan(basePackages={"com.example"})

public class SampleProjectApplication {

public static void main(String[] args) {
    SpringApplication.run(SampleProjectApplication.class, args);
  }

}