小编lev*_*ver的帖子

当我在Windows上创建.gitignore文件时,"必须输入文件名"错误

当我尝试这样做时,我收到以下错误:

gitignore错误

显然,Windows资源管理器不允许我创建这种类型的文件模式.我怎样才能克服这个问题?

windows git gitignore

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

仅在 Spring Boot 中的请求日志 CommonsRequestLoggingFilter 之前设置

CommonsRequestLoggingFilter在记录请求方面非常好,但就我而言,它在处理请求之前和之后记录相同的内容,这是重复且冗余的。我想摆脱请求后处理日志,但我找不到如何做到这一点。有任何想法吗?

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CommonsRequestLoggingFilter;

@Configuration
public class RequestLoggingFilterConfig {

    @Bean
    public CommonsRequestLoggingFilter logFilter() {
        CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter();
        filter.setIncludeClientInfo(true);
        filter.setIncludeHeaders(true);
        filter.setIncludePayload(false);
        filter.setIncludeQueryString(true);
        return filter;
    }
}

Run Code Online (Sandbox Code Playgroud)

我从这里开始

java logging spring spring-boot

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

jhipster - gyp动词`which`失败错误:未找到:python2

以下是我尝试使用 JHipster 生成新项目时得到的错误:

gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Program Files\Python36\python.EXE
gyp verb check python version `C:\Program Files\Python36\python.EXE -c "import platform; print(platform.python_version());"` returned: "3.6.4\r\n"
gyp verb could not find "C:\Program Files\Python36\python.EXE". checking python launcher
gyp verb could not find "C:\Program Files\Python36\python.EXE". guessing location
gyp verb ensuring that file exists: …
Run Code Online (Sandbox Code Playgroud)

python jhipster

11
推荐指数
3
解决办法
3万
查看次数

从Spring Boot 1.5.10迁移到2.0.0时,依赖关系无法解决

因此,我将我的基本应用程序从Spring Boot 1.5.10迁移到2.0.0.我正在使用Gradle,在迁移之前,我总是排除编译依赖项工件的版本号.迁移后,gradle构建任务开始抛出如下错误:

BUILD FAILED in 0s
2 actionable tasks: 1 executed, 1 up-to-date

During the build, one or more dependencies that were declared without a version failed to resolve:
    org.springframework.boot:spring-boot-starter-data-rest:
    org.springframework.boot:spring-boot-starter-web:
    org.springframework.boot:spring-boot-starter-data-jpa:

Did you forget to apply the io.spring.dependency-management plugin to the llutrackr project?
Run Code Online (Sandbox Code Playgroud)

build.gradle(我排除了不相关的部分):

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RELEASE")
    }
}

dependencies {
    compile("org.springframework.boot:spring-boot-starter-data-rest")
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-web')
}
Run Code Online (Sandbox Code Playgroud)

在我将版本号添加到相应的依赖项后,问题就解决了.为什么使用gradle构建Spring Boot 2.0项目需要进行此更改?甚至弹簧指南也不包括工件版本号.一个例子

gradle spring-boot

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

通过Spring Websocket STOMP打开连接会导致我们的服务器死机

所以我们在后端使用Spring websocket STOMP + RabbitMQ,我们遇到了打开文件描述符的麻烦.经过一段时间后,我们达到了服务器的限制,服务器不接受任何连接,包括websockets和API端点.

2018-09-14 18:04:13.605  INFO 1288 --- [MessageBroker-1] 
o.s.w.s.c.WebSocketMessageBrokerStats    : WebSocketSession[2 current WS(2)- 
HttpStream(0)-HttpPoll(0), 1159 total, 0 closed abnormally (0 connect 
failure, 0 send limit, 63 transport error)], stompSubProtocol[processed 
CONNECT(1014)-CONNECTED(1004)-DISCONNECT(0)], stompBrokerRelay[9 sessions, 
127.0.0.1:61613 (available), processed CONNECT(1015)-CONNECTED(1005)- 
DISCONNECT(1011)], inboundChannel[pool size = 2, active threads = 2, queued 
tasks = 2, completed tasks = 12287], outboundChannelpool size = 0, active 
threads = 0, queued tasks = 0, completed tasks = 4225], sockJsScheduler[pool 
size = 1, active threads = 1, …
Run Code Online (Sandbox Code Playgroud)

epoll stomp netty spring-websocket reactor-netty

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

Maven无法识别标签:'执行'

问题很简单.我<executions></executions>在我的pom.xml中添加了标签,但是我收到了以下错误:

[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: MyProject
POM Location: MyPOM

Reason: Parse error reading POM. Reason: Unrecognised tag: 'executions' (position: START_TAG seen ...</version>  \t\n\t\t\t\t\t\t    <executions>... @2014:23)
for project MyProject
Run Code Online (Sandbox Code Playgroud)

可能是由我使用的Maven版本引起的?我的Maven版本是2.1.0.我找不到"执行"标签的实施时间.没有"执行"标签,一切都很好,我尝试了一些来自网络的代码示例,但也没有用.有任何想法吗?

tags execution pom.xml maven

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

在Java中的setter中抛出Exception是一个好习惯吗?

更具体地说,我想编写一个代码,IllegalArgumentException如果给定值为负,则抛出该代码.我应该在setter/constructor中包含此代码,还是应该在调用适当的方法时检查该值?(如:start(),init(),print()run().无论)

我的代码(简化):

public class LLUAlgorithm {

private int temperature;

public int getTemperature() {
    return temperature;
}

public void setTemperature(int temperature) {
    if (temperature < 0)
        throw new IllegalArgumentException("can't be smaller than 0.")
    this.temperature = temperature;
}

public void run() {
    ...
}   
Run Code Online (Sandbox Code Playgroud)

我不记得一个setter如上所述抛出异常的情况.但我很好奇它是好还是坏.

java oop getter setter getter-setter

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

在cURL命令中使用环境变量 - Unix

我的问题很简单.我想在cURL命令中使用环境变量,类似于:

curl -k -X POST -H 'Content-Type: application/json' -d '{"username":"$USERNAME","password":"$PASSWORD"}' 
Run Code Online (Sandbox Code Playgroud)

当我运行命令时,$ USERNAME作为"$ USERNAME"字符串传递给命令而不是变量的值.有办法逃避这种情况吗?

谢谢.

unix linux shell curl environment-variables

6
推荐指数
3
解决办法
9241
查看次数

SonarQube规则:Spring Boot应用程序中“使用命令行参数对安全敏感”

SonarQube刚刚在非常基本的Spring Boot应用程序中显示了严重的安全问题。在主要方法上。

@SpringBootApplication
public class Application {

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

}
Run Code Online (Sandbox Code Playgroud)

SonarQube要我 Make sure that command line arguments are used safely here.

我在StackOverflow和Google上都进行了搜索,但令我惊讶的是我找不到关于此问题的任何评论。我几乎可以确定该SpringApplication.run方法内部已经进行了一些安全检查。而且,我什至不记得有人在调用之前清理了主方法的参数SpringApplication.run。我只是想将其标记为误报并继续。

在这里也要问这个问题的一部分:SonarQube在Spring Framework控制器和Spring Framework Application主类中显示安全错误。

是假阳性吗?

java spring-boot sonarqube

6
推荐指数
3
解决办法
857
查看次数

Postgres 检查文本数组中值的有效性的约束

我想创建类似的东西

CHECK (ALL(scopes) IN ('read', 'write', 'delete', 'update'))
Run Code Online (Sandbox Code Playgroud)

scopes这是表中的一个字段,text[]我想确保该数组中的所有值都是上述值之一。对此有何意见?是否有可能通过SELECT另一个表获取这些值?

我已经看到了下面的解决方案,但我很好奇是否有更简单的解决方案。

Postgresql 使用函数检查数组中所有单个元素的约束

sql postgresql

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

如何运行Windows命令并每次都返回true?

我的问题很简单.我想运行一个Windows命令,每次运行时总是以非零值退出.我无法访问命令本身,并且在调用它时想要操作退出代码.是这样的:

C:\>run.cmd || echo "OK"
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

提前致谢.

windows command-line command batch-file jenkins

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

尝试使用Grape抓取groovy-ssh插件时抛出ClassNotFoundException

当我简单地使用Grape抓取groovy-ssh插件时,会抛出异常.我使用这里的代码:https://github.com/int128/groovy-ssh

@Grab('org.hidetake:groovy-ssh:1.5.0')
@Grab('ch.qos.logback:logback-classic:1.1.2')
def ssh = org.hidetake.groovy.ssh.Ssh.newService()
println "Test"

BUG! exception in phase 'conversion' in source unit 'delete.groovy' # Licensed to the Apache Software Foundation (ASF) under one or more
Caused by: java.lang.ClassNotFoundException: # Licensed to the Apache Software Foundation (ASF) under one or more
Run Code Online (Sandbox Code Playgroud)

有谁见过这个错误?

ssh groovy

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