小编dsp*_*egs的帖子

如何混合Spring Data Repositories和Spring Rest Controller

目前,我通过使用@RepositoryRestResource注释它们来将一些Spring数据库公开为RESTful服务,如下所示:

@RepositoryRestResource(collectionResourceRel = "thing1", path = "thing1")
public interface Thing1Repository extends PagingAndSortingRepository<Thing1, String> {}

@RepositoryRestResource(collectionResourceRel = "thing2", path = "thing2")
public interface Thing2Repository extends CrudRepository<Thing2, String> {}
Run Code Online (Sandbox Code Playgroud)

一切都很好.当你点击我的第一个端点时,还会显示我公开的所有Spring Data Repositories,如下所示:

{
   _links: {
      thing1: {
         href: "http://localhost:8080/thing1{?page,size,sort}",
         templated: true
      },
      thing2: {
         href: "http://localhost:8080/thing2"
      }
   }
}
Run Code Online (Sandbox Code Playgroud)

现在我有一些我想公开的端点,这些端点无法由Spring Data Repositories表示,所以我使用的是RestController.

这是一个简单的例子:

@RestController
@ExposesResourceFor(Thing3.class)
@RequestMapping("/thing3")
public class Thing3Controller {

  @Autowired 
  EntityLinks entityLinks;

  @Autowired 
  Thing3DAO thing3DAO;

  //just assume Thing3.class extends ResourceSupport. I know this is wrong, but it makes the example shorter …
Run Code Online (Sandbox Code Playgroud)

java spring spring-data spring-data-rest spring-hateoas

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

mongodb 出错。属性列表后缺少“}”

使用以下代码我收到此错误:

SyntaxError: missing } after property list <shell>:3
Run Code Online (Sandbox Code Playgroud)

有谁知道我做错了什么?花括号看起来很平衡,所以我想知道我是否在其他地方犯了错误。

db.test.save(
{
     "name":"John Doe"
     "attribute":"false"
     "num1":99
     "num2":85
     "num3"{
            "n1":11
            "n2":9
            "n3":8
            "n4":9
     }
     "num4"{
            "m1":15
            "m2":6
            "m3":5
            "m4":12
     }
}
)
Run Code Online (Sandbox Code Playgroud)

javascript json mongodb bson

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

如何将 WiX 属性默认为 null?

我正在开发一组将共享通用表单的 WiX 安装程序。每个应用程序都需要设置这些值,但每个应用程序的值都不同。

我试图允许属性(链接到控件)具有默认值(或不具有默认值),并允许通过命令行设置属性值。

在我的“SharedDialog.wxs”中我有:

<Fragment>
   <PropertyRef Id="PROP1"/>
   <PropertyRef Id="PROP2"/>
   <UI>
      <Dialog Id="SharedDialog" Width="370" Height="270" Title="[ProductName]">
         <Control Type="Edit" Id="1" Property="PROP1" Wid... Indirect="no" />
         <Control Type="CheckBox" Id="2" Property="PROP2" Wid...  
           CheckBoxValue="1" Indirect="no"/>
      </Dialog>
</Fragment>
Run Code Online (Sandbox Code Playgroud)

在应用程序特定项目的文件中:

<Fragment>
   <Property Id="PROP1" Value="Test"/>
   <Property Id="PROP2" Value="1"/>
</Fragment>
Run Code Online (Sandbox Code Playgroud)

这一切都适用于我想要做的事情,但问题是当我想像这样清除值时:(所以它们没有默认值)

<Fragment>
   <Property Id="PROP1"/>
   <Property Id="PROP2"/>
</Fragment>
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

Unresolved reference to symbol 'Property:PROP1' in section 'Fragment:'. 
Unresolved reference to symbol 'Property:PROP2' in section 'Fragment:'.
Run Code Online (Sandbox Code Playgroud)

WiX 也不会让您将值设置为“”。问题是,据我所知,如果该属性具有值,则该复选框将始终被选中。如何将属性“PROP2”设置为“null”?

installation windows-installer wix

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