我正在使用配置了@EnableHypermediaSupport(type = HAL)的Spring Boot和Spring Hateoas.虽然这在基本场景中运行良好,但我希望能够为链接添加其他属性.例如,很容易返回链接,这些链接将呈现如下链接:
{
"_links":{
"self":{
"href":"http://localhost/"
},
"something":[
{
"href":"http://some-url.com/something1"
},
{
"href":"http://some-url.com/something2"
}
]
}
Run Code Online (Sandbox Code Playgroud)
我想要做的是为rel中的对象添加更多属性.例如:
{
"_links":{
"self":{
"href":"http://localhost/"
},
"something":[
{
"name":"something1",
"href":"http://some-url.com/something1"
},
{
"name":"something2",
"href":"http://some-url.com/something2"
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
在不创建自己的DTO的情况下,最好的方法是什么(最好使用ControllerLinkBuilder)?我已经尝试创建自己的Link子类并为name(以及getter和setter)添加字段,但它们似乎被忽略了.
我正在尝试使用Spring Security OpenId启动并运行Spring 4.0启动应用程序.我正在使用标准方式来引导Spring启动应用程序:
@Configuration
@ComponentScan("x.y.z")
@EnableAutoConfiguration
@Import({SecurityConfig.class})
public class ServiceRegistryStart extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(ServiceRegistryStart.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
application.sources(getClass());
return application;
}
}
Run Code Online (Sandbox Code Playgroud)
SecurityConfig.class看起来像这样(受Spring安全性中的"openid-jc示例项目"影响):
@Configuration
@EnableWebMvcSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/resources/**").permitAll()
.anyRequest().authenticated()
.and()
.openidLogin()
.loginPage("/login.html")
.permitAll()
.authenticationUserDetailsService(new CustomUserDetailsService())
.attributeExchange("https://www.google.com/.*")
.attribute("email")
.type("http://axschema.org/contact/email")
.required(true)
.and()
.attribute("firstname")
.type("http://axschema.org/namePerson/first")
.required(true)
.and()
.attribute("lastname")
.type("http://axschema.org/namePerson/last")
.required(true)
.and()
.and()
.attributeExchange(".*yahoo.com.*")
.attribute("email")
.type("http://axschema.org/contact/email")
.required(true)
.and() …Run Code Online (Sandbox Code Playgroud) 我正在寻找一个可以在clojars中使用的(最好是小的)Clojure库,它允许我替换字符串中的简单模板,例如:
"你好我的名字是$ {name}"
这里${name}应该由模板引擎来代替.在Java中,我通常使用完美的JMTE.我知道我也可以在Clojure中使用它,但我想知道是否有更多Clojure友好/惯用的东西.
我们研究了存储和读取大量不可变数据(事件)的选项,我希望得到一些关于 MongoDB 是否适合的反馈。
要求:
如果 MongoDB 非常适合这一点,那么是否可以调整一些配置或设置来提高不可变数据的性能或可靠性?
我们正在调查存储和阅读大量不可变数据(事件)的选项,我想对Cassandra是否合适的一些反馈.
要求:
以任何其他方式查询数据不是主要问题,因为Cassandra是模式数据库,我不认为当事件有多种不同的形式时它是可能的吗?Cassandra会适合这个吗?如果有,那么应该注意什么?
我们在 Google Cloud 中设置了 Wordpress(如果重要的话,在 Google Container Engine 中设置 Kubernetes)并配置了 HTTP 负载均衡器。作为执行此操作的一部分,我们设置了一个健康检查,其配置如下:
但奇怪的是,当我跟踪 WordPress 实例的日志时,它看起来像这样:
10.244.1.1 - - [21/Jan/2016:08:52:28 +0000] "GET /?healthCheck=true HTTP/1.1" 200 36784 "-" "GoogleHC/1.0"
10.244.1.1 - - [21/Jan/2016:08:52:30 +0000] "GET /?healthCheck=true HTTP/1.1" 200 36784 "-" "GoogleHC/1.0"
10.240.0.3 - - [21/Jan/2016:08:52:32 +0000] "GET /?healthCheck=true HTTP/1.1" 200 36784 "-" "GoogleHC/1.0"
10.244.1.1 - - [21/Jan/2016:08:52:33 +0000] "GET /?healthCheck=true HTTP/1.1" 200 36784 "-" "GoogleHC/1.0"
10.240.0.2 - - [21/Jan/2016:08:52:35 +0000] "GET /?healthCheck=true HTTP/1.1" 200 36784 "-" "GoogleHC/1.0"
Run Code Online (Sandbox Code Playgroud)
即,健康检查看起来每隔一秒(甚至更多?)发送一次。为什么会这样呢?
我正在使用spring-data-redis,spring-session和 Spring Boot 连接到我的 Redis 实例。但是,我不想spring-data-redis连接到 DB 0(默认),而是连接到另一个本地数据库(比如 DB 1)。这是我想要存储会话的地方。spring-data-redis 可以实现吗?
背景
我使用 Datomic 来存储其他系统生成的事件的投影(在这种情况下,投影可以被视为 Datomic 中的实体)。这些事件有一个与之关联的时间戳,用于说明事件的创建时间(例如)。这显然与 Datomic 在投影中存储新属性(基于事件)时分配给事务的事务时间不同。我的应用程序的用户对交易时间不感兴趣,而是对事件时间感兴趣。我首先使用 Datomic 的原因是为了能够获取特定时间的实体(或查询数据库)。然而,这个时间不应该是 Datomic 交易时间,而是事件时间。例如,我希望能够根据此事件时间获取一个实体:
(datomic/entity (datomic/as-of db event-time) id)
Run Code Online (Sandbox Code Playgroud)
可能的解决方案
我正在考虑的一个想法是将:db/txInstant每笔交易设置为事件时间,但建议我不要这样做作为一般原则。另一个潜在的问题是您无法分配:db/txInstant比模式更旧的模式(在我的应用程序中就是这种情况)。:db/txInstant解决方案是在创建模式的事务中尽早设置。
问题
在 Datomic 中,人们通常如何处理事件时间而不是事务时间?“可能的解决方案”如何成立?
我们的Java DTO中通常包含一个由Javadoc中定义的表组成的更改日志:
/**
* Changelog:
*
* <table>
* <tr><th>Version</th><th>Description</th></tr>
* <tr>
* <td>2</td>
* <td>Added field 'something'</td>
* </tr>
* <tr>
* <td>3</td>
* <td>Added field 'somethingElse'</td>
* </tr>
* </table>
*/
public class MyDTO {
...
}
Run Code Online (Sandbox Code Playgroud)
这使得(在Intellij中使用Javadoc预览版)很好地呈现如下:
现在我们想为我们的Kotlin数据类做同样的事情.阅读KDoc的文档,其中说:
对于内联标记,KDoc使用常规Markdown语法,扩展为支持用于链接到代码中其他元素的简写语法.
所以我尝试使用Markdown语法创建一个表:
/**
* Changelog:
*
*| Version | Description |
*| ------------- | -------------------------- |
*| 2 | Added field 'something' |
*| 3 | Added field 'somethingElse' |
*
*/
data class MyKotlinDTO(..) {
... …Run Code Online (Sandbox Code Playgroud) 我正在使用 Java 和 Maven 来构建我的服务器应用程序(请参阅github),通常您将源代码放在文件夹中src/main/<language>并在src/test/<language>.
使用 Elm,我使用elm-explorations/test来运行我的测试(因为我使用的是 Elm 0.19),但我似乎找不到将测试文件夹更改src/test/elm为tests.
例如,我尝试过更改elm.json和添加:
"test-directories": [
"src/test/elm"
]
Run Code Online (Sandbox Code Playgroud)
但这似乎不起作用。所以我的问题是:
如何更改elm-test假设测试所在的文件夹?
clojure ×2
immutability ×2
spring-boot ×2
cassandra ×1
datomic ×1
elm ×1
elm-test ×1
hal-json ×1
json ×1
kdoc ×1
kotlin ×1
mongodb ×1
openid ×1
spring ×1
spring-data ×1
spring-mvc ×1
string ×1
time ×1
transactions ×1