Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.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
Java 如何配置jhipster应用程序_Java_Spring_Backend_Jhipster_Jhipster Gateway - Fatal编程技术网

Java 如何配置jhipster应用程序

Java 如何配置jhipster应用程序,java,spring,backend,jhipster,jhipster-gateway,Java,Spring,Backend,Jhipster,Jhipster Gateway,我是杰普斯特的新手。我使用terminal jhipster命令生成了一个项目。我有一个网关服务,在尝试启动应用程序时,我遇到了这些错误,有趣的是,我没有修改任何东西,这只是开箱即用的。我有java 15,: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gatewayResource' defined in file : Unable to res

我是杰普斯特的新手。我使用terminal jhipster命令生成了一个项目。我有一个网关服务,在尝试启动应用程序时,我遇到了这些错误,有趣的是,我没有修改任何东西,这只是开箱即用的。我有java 15,:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'gatewayResource' defined in file : Unable to resolve Configuration with the provided Issuer of "http://localhost:9080/auth/realms/jhipster"

    
这是我的网关类:

    package com.moniesta.admin.web.rest;

import com.moniesta.admin.web.rest.vm.RouteVM;

import java.util.ArrayList;
import java.util.List;

import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.gateway.route.Route;
import org.springframework.cloud.gateway.route.RouteLocator;
import reactor.core.publisher.Flux;
import org.springframework.http.*;
import org.springframework.security.access.annotation.Secured;
import com.moniesta.admin.security.AuthoritiesConstants;
import org.springframework.web.bind.annotation.*;

/**
 * REST controller for managing Gateway configuration.
 */
@RestController
@RequestMapping("/api/gateway")
public class GatewayResource {

    private final RouteLocator routeLocator;

    private final DiscoveryClient discoveryClient;

    @Value("${spring.application.name}")
    private String appName;

    public GatewayResource(RouteLocator routeLocator, DiscoveryClient discoveryClient) {
        this.routeLocator = routeLocator;
        this.discoveryClient = discoveryClient;
    }

    /**
     * {@code GET  /routes} : get the active routes.
     *
     * @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the list of routes.
     */
    @GetMapping("/routes")
    @Secured(AuthoritiesConstants.ADMIN)
    public ResponseEntity<List<RouteVM>> activeRoutes() {
        Flux<Route> routes = routeLocator.getRoutes();
        List<RouteVM> routeVMs = new ArrayList<>();
        routes.subscribe(route -> {
            RouteVM routeVM = new RouteVM();
            // Manipulate strings to make Gateway routes look like Zuul's
            String predicate = route.getPredicate().toString();
            String path = predicate.substring(predicate.indexOf("[") + 1, predicate.indexOf("]"));
            routeVM.setPath(path);
            String serviceId = route.getId().substring(route.getId().indexOf("_") + 1).toLowerCase();
            routeVM.setServiceId(serviceId);
            // Exclude gateway app from routes
            if (!serviceId.equalsIgnoreCase(appName)) {
                routeVM.setServiceInstances(discoveryClient.getInstances(serviceId));
                routeVMs.add(routeVM);
            }
        });
        return ResponseEntity.ok(routeVMs);
    }
}
package com.moniesta.admin.web.rest;
导入com.moniesta.admin.web.rest.vm.RouteVM;
导入java.util.ArrayList;
导入java.util.List;
导入org.springframework.cloud.client.DiscoveryClient;
导入org.springframework.beans.factory.annotation.Value;
导入org.springframework.cloud.gateway.route.route;
导入org.springframework.cloud.gateway.route.RouteLocator;
导入reactor.core.publisher.Flux;
导入org.springframework.http.*;
导入org.springframework.security.access.annotation.securied;
导入com.moniesta.admin.security.authorities常量;
导入org.springframework.web.bind.annotation.*;
/**
*用于管理网关配置的REST控制器。
*/
@RestController
@请求映射(“/api/gateway”)
公共类网关资源{
专用最终路由器路由器;
私人最终发现客户发现客户;
@值(${spring.application.name}”)
私有字符串appName;
公共网关资源(RouteLocator RouteLocator、DiscoveryClient DiscoveryClient){
this.routeLocator=routeLocator;
this.discoveryClient=discoveryClient;
}
/**
*{@code GET/routes}:获取活动路由。
*
*@return状态为{@code 200(OK)}的{@link ResponseEntity}和正文路由列表。
*/
@GetMapping(“/routes”)
@安全(AuthoritiesConstants.ADMIN)
公共响应活动路线(){
Flux routes=routeLocator.getRoutes();
List routeVMs=new ArrayList();
路由。订阅(路由->{
RouteVM RouteVM=新的RouteVM();
//操纵字符串使网关路由看起来像Zuul的
字符串谓词=route.getPredicate().toString();
字符串路径=predicate.substring(predicate.indexOf(“[”)+1,predicate.indexOf(“]);
routeVM.setPath(路径);
字符串serviceId=route.getId().substring(route.getId().indexOf(“”)+1.toLowerCase();
routeVM.setServiceId(serviceId);
//从路由中排除网关应用程序
如果(!serviceId.equalsIgnoreCase(appName)){
routeVM.setServiceInstances(discoveryClient.getInstances(serviceId));
routeVMs.add(routeVM);
}
});
返回响应正确(routeVMs);
}
}

请编辑您的问题,但有完整错误。另外,您选择的身份验证类型是什么?看起来像keydove,如果是这样的话,你是从docker compose开始的吗?嗨,我怎么能发布它?它超过了允许的符号计数。。。我选择了oath2,但我需要立即启动它吗?您可以在外部站点上发布完整错误并将其链接到此处,例如,您可以从github帐户创建要点,但堆栈跟踪超出stackoverflow限制,这让我感到惊讶。对于JHipster初学者,您选择了相当复杂的选项:微服务体系结构+oauth2。您是否阅读了文档和项目的README.md?