小编tle*_*que的帖子

Spring-Boot:如何添加tomcat连接器以绑定到控制器

在Spring-Boot文档中,有一节描述了如何为tomcat启用多个连接器(http://docs.spring.io/spring-boot/docs/1.1.7.RELEASE/reference/htmlsingle/#howto- enable-multiple-connectors-in-tomcat).

但有没有办法简单地将连接器添加到现有连接器(Web和管理连接器)?并将它们绑定到一些mvc控制器?我想要做的是创建一些可以在不同端口上访问的Web服务.

java spring spring-boot

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

如何知道滚动条在 JavaFx TableView 上是否可见

有没有办法知道表格视图上是否存在滚动条?(除了我在下面的代码中所做的)我的目标是在桌子的右侧(桌子上方)放置 2 个箭头图像(以关闭/打开侧面板)。但我不想把它们放在滚动条上。表格内容是搜索的结果,因此有时滚动条可见,有时则不可见。如果没有足够的物品。我希望每次 tableview 项目更改时我的箭头的位置都会更改。

我已经尝试了以下解决方案,但结果是第二次搜索时箭头会移动。看起来像一个并发问题。就像在呈现表之前执行我的侦听器代码一样。

有没有办法解决这个问题?

tableView.getItems().addListener( (ListChangeListener<LogData>) c -> {    
// Check if scroll bar is visible on the table
// And if yes, move the arrow images to not be over the scroll bar
Double lScrollBarWidth = null;
Set<Node> nodes = tableView.lookupAll( ".scroll-bar" );
for ( final Node node : nodes )
{
    if ( node instanceof ScrollBar )
    {
        ScrollBar sb = (ScrollBar) node;
        if ( sb.getOrientation() == Orientation.VERTICAL )
        {
            LOGGER.debug( "Scroll bar visible : …
Run Code Online (Sandbox Code Playgroud)

javafx javafx-2 javafx-8

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

内存中的角度 web-api 没有响应

我正在尝试完成著名的 Angular 英雄之旅教程(不是 js!),但使用 angular-cli 来创建项目。一切都很好,直到使用 angular-in-memory-web-api 部分。是的,我确实使用了命令“npm install angular-in-memory-web-api --save”,依赖项现在位于我的 package.json 中。

运行应用程序时完全没有错误。没有编译错误。js 控制台中没有运行时错误。什么也没发生。就像“api 服务器”没有响应一样。

我什至添加了一些 console.debug 以确保“createDb()”和我的“getHeroes()”函数被执行。

知道去哪里看吗?这是我的一些文件。

包.json:

{
"name": "angular-tour-of-heroe",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^4.0.0",
    "@angular/compiler": "^4.0.0",
    "@angular/core": "^4.0.0",
    "@angular/forms": "^4.0.0",
    "@angular/http": "^4.0.0",
    "@angular/platform-browser": "^4.0.0",
    "@angular/platform-browser-dynamic": "^4.0.0",
    "@angular/router": "^4.0.0",
    "angular-in-memory-web-api": "latest",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": …
Run Code Online (Sandbox Code Playgroud)

angular

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

GraphQL:如何为查询和变异重用相同的类型?

假设我有一个像这样定义的查询:

type Query {
  # The basic me query
  getUser(id:Int): [User]
}

type User {
  id: ID!
  login: String!
  name: String    
}
Run Code Online (Sandbox Code Playgroud)

但现在我需要有一个突变来添加一个用户。我的直觉是这样的:

type Mutation {  
  addUser(newUser: User): [User]
}
Run Code Online (Sandbox Code Playgroud)

但它不起作用,因为突变不能使用“查询类型”。它需要使用“输入类型”。我知道在这个例子中,做起来并不复杂,但是如果用户是一个非常复杂的类型,使用了许多子类型。我怎样才能做到这一点?是否需要重新使用类型作为突变参数?

graphql

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

在没有父 POM 的情况下使用 Spring Boot 不起作用

我正在尝试 SpringBoot QuickStart ( http://projects.spring.io/spring-boot/#quick-start ) 中的简单示例。使用 spring-boot-starter-parent 作为父级工作正常。我可以毫无问题地运行示例。但我绝对需要使用我自己的父 pom。所以我阅读了文档:http : //docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#using-boot-maven-without-a-parent

我尝试过这个。它编译得很好。但是在运行时崩溃。这是我的配置。在我的父 pom 中:

<dependencyManagement>
    <dependencies>
    ....
        <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>1.1.5.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    ....
    </dependencies>
</dependencyManagement>
Run Code Online (Sandbox Code Playgroud)

在我的pom中:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)

但是当我运行应用程序时,我得到了这个:


    2014-08-11 12:50:29.275 ERROR 28474 --- [           main] o.s.boot.SpringApplication               : Application startup failed

java.lang.IllegalStateException: Failed to introspect annotations: class com.imetrik.oaas.tool.application.springboottest.SampleController.SampleController
    at org.springframework.core.annotation.AnnotatedElementUtils.process(AnnotatedElementUtils.java:169)
    at org.springframework.core.annotation.AnnotatedElementUtils.isAnnotated(AnnotatedElementUtils.java:75)
    at org.springframework.core.type.StandardAnnotationMetadata.isAnnotated(StandardAnnotationMetadata.java:102)
    at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:138)
    at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.registerBean(AnnotatedBeanDefinitionReader.java:128)
    at org.springframework.context.annotation.AnnotatedBeanDefinitionReader.register(AnnotatedBeanDefinitionReader.java:123)
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:159)
    at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:135) …
Run Code Online (Sandbox Code Playgroud)

java spring spring-boot

2
推荐指数
2
解决办法
7821
查看次数

如何过滤另一个数组中的数组

假设我有一个这样的数组:

[
  {
    name:"1",
    args: [1,2,3,4,5]
  },
  {
    name:"2",
    args: [2,3,4,5,6]
  }
]
Run Code Online (Sandbox Code Playgroud)

我想要做的是删除所有值 < 4 的“参数”,得到以下结果:

[
  {
    name:"1",
    args: [4,5]
  },
  {
    name:"2",
    args: [4,5,6]
  }
]
Run Code Online (Sandbox Code Playgroud)

我如何使用 Observables (Rxjs) 做到这一点。我尝试使用mergeMap,但它似乎确实可以满足我的需求。

javascript arrays observable rxjs

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