小编Tom*_*ing的帖子

Git - push.default"匹配"和"简单"之间有什么区别

我一直在使用git一段时间,但我自己从来没有设置过新的远程仓库,我一直很好奇这样做.我一直在阅读教程,我对如何让"git push"工作感到困惑.

如果我只是用git push它要求我查看默认分支(?)指向?它为我提供的这两个选项有什么区别?

git config --global push.default matching
git config --global push.default simple
Run Code Online (Sandbox Code Playgroud)

匹配只是推动我在本地仓库上的任何分支,如果它们不匹配,我必须手动告诉它推送我所拥有的任何新的本地分支,对吗?这是最好的做法还是最简单的?

git git-pull git-push git-remote

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

Exception handling in Grails controllers

我知道如何使用UrlMappings在Grails中进行通用异常处理,并使用ErrorController进行泛型异常处理,这样如果异常转义控制器,用户将被发送到通用错误页面并记录异常.我也知道如何使用try/catch块来处理特定异常并尝试从中恢复.

但是在大多数控制器中,如果发生异常,我只想给用户一个稍微更具体的错误消息.所以在创建操作中,我想告诉用户该项目未创建.或者在导入操作中,我想告诉用户导入失败.现在,控制器看起来像:

class ThingController {
  def create = {
    try {
      // The real controller code, which quickly hands it off to a service
    } catch (Exception e) {
      handleException(e, "There was an error while attempting to create the Thing")
    }
  }

  def delete = {
    try {
      // The real controller code, which quickly hands it off to a service
    } catch (Exception e) {
      handleException(e, "There was an error while attempting to delete the Thing")
    }
  }

  private …
Run Code Online (Sandbox Code Playgroud)

grails controller exception-handling exception

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

停止或重新加载后出现错误"无法在Linux guest虚拟机中装入文件夹"

我试图用从别人一个流浪框,当我第一次启动它,它工作正常,但在我停止,并用重新启动它vagrant halt和vagrant up,或者vagrant reload,我收到以下错误信息:

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant

The error output from the last …
Run Code Online (Sandbox Code Playgroud)

linux virtualbox vagrant

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

OpenAPI 在 Spring Boot 应用程序中转义 JSON 响应

我最近尝试为我的 Sprint Boot 应用程序生成 OpenAPI 文档。我将以下几行添加到我的pom.xml

<dependency>
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-ui</artifactId>
    <version>1.2.30</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

但是当我在本地主机上点击 swagger-ui URL 时,我得到了这个页面 在此输入图像描述

我检查了 JSON,/v3/api-docs并得到了以下开头的响应:

"{\"openapi\":\"3.0.1\",\"info\":{\"title\":\"OpenAPI definition\",\"version\":\"v0\"},\"servers\":[{\"url\":\"https://localhost:8900/tds\",
Run Code Online (Sandbox Code Playgroud)

我可以看到正在指定该openapi字段,但看起来整个响应都是字符串化的,而不仅仅是 JSON。由于 OpenAPI 似乎没有任何配置,我认为它是从我的 Spring Boot 配置中的某些内容获取的,但我不知道在哪里。

spring-boot openapi-generator

6
推荐指数
1
解决办法
1921
查看次数

在 Spring Security SAML2 中自定义 OpenSaml4AuthenticationProvider

我需要使用UserDetailsServiceSpring Security SAML2 的遗留版本,因此我遵循Spring 的这些说明。AuthenticationProvider但是,当我尝试根据该文档将其替换为所谓的“默认”时,我收到错误:

public class WigWebSecurityConfiguration extends WebSecurityConfigurerAdapter {
  @Override
  protected void configure(HttpSecurity httpSecurity) throws Exception {
    OpenSaml4AuthenticationProvider authenticationProvider = new OpenSaml4AuthenticationProvider();
    // I've tried removing these 2 lines and I get the same error
    authenticationProvider.setAssertionValidator(OpenSaml4AuthenticationProvider.createDefaultAssertionValidator());
    authenticationProvider.setResponseAuthenticationConverter(OpenSaml4AuthenticationProvider.createDefaultResponseAuthenticationConverter());

    httpSecurity.authorizeRequests(authz -> authz.anyRequest().authenticated())
      .saml2Login(saml2 -> saml2.authenticationManager(new ProviderManager(authenticationProvider)));
  }
}
Run Code Online (Sandbox Code Playgroud)

当我这样做时,当我尝试进行身份验证时收到以下错误:

java.lang.NoSuchMethodError: org.opensaml.saml.saml2.assertion.SAML20AssertionValidator.<init>(Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;Lorg/opensaml/saml/saml2/assertion/AssertionValidator;Lorg/opensaml/xmlsec/signature/support/SignatureTrustEngine;Lorg/opensaml/xmlsec/signature/support/SignaturePrevalidator;)V
    at org.springframework.security.saml2.provider.service.authentication.OpenSaml4AuthenticationProvider$SAML20AssertionValidators$3.<init>(OpenSaml4AuthenticationProvider.java:732)
    at org.springframework.security.saml2.provider.service.authentication.OpenSaml4AuthenticationProvider$SAML20AssertionValidators.<clinit>(OpenSaml4AuthenticationProvider.java:731)
    at org.springframework.security.saml2.provider.service.authentication.OpenSaml4AuthenticationProvider.lambda$createDefaultAssertionSignatureValidator$8(OpenSaml4AuthenticationProvider.java:572)
    at org.springframework.security.saml2.provider.service.authentication.OpenSaml4AuthenticationProvider.lambda$createAssertionValidator$11(OpenSaml4AuthenticationProvider.java:654)
    at org.springframework.security.saml2.provider.service.authentication.OpenSaml4AuthenticationProvider.process(OpenSaml4AuthenticationProvider.java:495)
    at org.springframework.security.saml2.provider.service.authentication.OpenSaml4AuthenticationProvider.authenticate(OpenSaml4AuthenticationProvider.java:448)
    at org.springframework.security.authentication.ProviderManager.authenticate(ProviderManager.java:182)
    at org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter.attemptAuthentication(Saml2WebSsoAuthenticationFilter.java:113)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:222)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:212)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:336)
Run Code Online (Sandbox Code Playgroud)

但是,当我使用相同的代码而不设置 …

spring-security spring-security-saml2

6
推荐指数
1
解决办法
5652
查看次数

如何使用qmake创建自定义Makefile目标

据我所知,qmake处理.pro文件以生成用于构建实际qt应用程序的Makefile.

也就是说,我怎样才能让qmake生成带有一些自定义Makefile目标的Makefile?

具体来说,我想在Makefile中有一个名为" package " 的目标,它将运行为我刚刚编译的qt应用程序创建包所需的所有步骤

qmake qt4

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

如何在mongodb中使用$和operator - java驱动程序

我们如何使用逻辑AND($和)查询mongo,

示例:集合:主题

从收集主题我需要得到满足条件的所有记录,

totalmarks!= 10和totalmarks!= 15.

java mongodb

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

最小化窗口后冻结的小部件

我正在为应用程序使用Qt5 Creator,并且在主窗口的构造函数中调用this->setWindowState(Qt::WindowMaximized)。当窗口最初最大化时,单选按钮和复选框可以正常工作(即,轻松地在选中和未选中之间切换)。

但是,如果我将其最小化并最大化,则单选按钮和复选框似乎会冻结并且不会随意切换。但是,如果我再次恢复原状,一切都会好起来的。

我尝试this->update在单选按钮和复选框的插槽中包括a ,但这没有用。任何帮助,将不胜感激。

user-interface qt qmainwindow qt5

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

为什么我要使用一个JVM而不是另一个?

我强烈怀疑这个问题不适合Q&A格式,但我很难找到正确的单词 - 随意重复这个问题.

所以我正在查看维基百科的Java虚拟机列表,我发现自己在想,因为Java是一种可移植的语言,为什么有人会选择一个JVM而不是另一个?这是表演吗?有些更安全吗?

java jvm

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