我有一个字节的数组,如果我将这些字节写入文件,我想计算文件大小.没有将文件写入光盘是否可能?
我有一些对象
class A {
private Long id;
private String name;
public boolean equals(Long v) {
return this.id.equals(v);
}
}
Run Code Online (Sandbox Code Playgroud)
和这些对象的ArrayList.我想要的是能够检查该列表是否包含一个按对象的字段的对象.例如:
ArrayList<A> list = new ArrayList<A>(); if (list.contains(0L)) {...}
Run Code Online (Sandbox Code Playgroud)
但是压倒的Equals方法对我没有帮助.我做错了什么?谢谢
更新 我应该覆盖hashcode()方法吗?
我有这样的网址 - http://www.coolsite.com/daily-plan/#id=1 解析该字符串并读取哈希值(#id =之后的值)的最简单方法是什么?谢谢
我做了一个应该暴露嵌套实体的投影:
@Projection(name = "inlineBusiness", types = { UserModel.class })
public interface InlineBusinessUserModelProjection {
String getUsername();
String getFirstName();
String getLastName();
Date getBirthdate();
String getEmail();
BusinessModel getBusiness();
}
Run Code Online (Sandbox Code Playgroud)
和服务存储库:
@RepositoryRestResource(collectionResourceRel = "users", path = "users",
excerptProjection = InlineBusinessUserModelProjection.class)
public interface UserRepository extends BaseDAO<UserModel> {..}
Run Code Online (Sandbox Code Playgroud)
因为/users它工作正常,业务领域暴露与嵌套实体,但当我调用/users/1- 没有,也所有自定义方法..似乎投影不参与任何方法除了/users
任何想法?
有没有办法按范围在hibernate.cfg.xml中定义对象而不是逐个?
例如,在Spring中,您可以通过这样的注释定义所有控制器:
<context:component-scan base-package="crm.controller" />
Run Code Online (Sandbox Code Playgroud)
我可以用同样的方式定义hibernate类吗?或者它必须逐个定义?
谢谢
我正在使用Spring Security,并想知道如果该页面包含#(哈希)符号,如何在成功登录到源页面后实现重定向.
现在我使用always-use-default-target="false"它在URL类型的工作正常:/path/to/page/.
但是当URL变为#/path/to/page它时,它不会进行任何重定向.
有没有办法解决它?
我最近将SonarQube服务器从5.1.2升级到5.2.我们通过Jenkins使用SonarQube Runner(2.4)进行分析,分析成功.问题是分析然后不会被服务器处理.可以在日志末尾看到以下错误,该错误显示为失败的后台任务:
主要错误是这样的:
java.lang.UnsupportedOperationException: QualityGate status can not be changed if already set on source Measure
Run Code Online (Sandbox Code Playgroud)
我不知道这可能是指什么...这里有更多的日志:
2015.11.05 13:53:18 INFO [o.s.s.c.s.ComputationStepExecutor] Compute size measures | time=1114ms
2015.11.05 13:53:21 INFO [o.s.s.c.s.ComputationStepExecutor] Compute new coverage | time=2683ms
2015.11.05 13:53:21 INFO [o.s.s.c.s.ComputationStepExecutor] Compute coverage measures | time=586ms
2015.11.05 13:53:21 INFO [o.s.s.c.s.ComputationStepExecutor] Compute comment measures | time=118ms
2015.11.05 13:53:22 INFO [o.s.s.c.s.ComputationStepExecutor] Copy custom measures | time=947ms
2015.11.05 13:53:22 INFO [o.s.s.c.s.ComputationStepExecutor] Compute duplication measures | time=58ms
2015.11.05 13:53:22 INFO [o.s.s.c.s.ComputationStepExecutor] Compute language distribution | time=80ms …Run Code Online (Sandbox Code Playgroud) 我使用Spring Data REST的投影功能,以便在JSON中包含一些嵌套类型的对象:
{
"id": 1,
"name": "TEST",
"user": {
"id": 1,
"name": "user1"
},
_links: {
self: {
href: "http://localhost:8082/accounts/1{?projection}",
templated: true
},
user: {
href: "http://localhost:8082/accounts/1/users"
},
}
}
Run Code Online (Sandbox Code Playgroud)
如何在嵌套对象中生成链接?我想要以下JSON表示:
{
"id": 1,
"name": "TEST",
"user": {
"id": 1,
"name": "user1",
_links: {
self: {
href: "http://localhost:8082/users/1",
templated: true
},
}
},
_links: {
self: {
href: "http://localhost:8082/accounts/1{?projection}",
templated: true
},
user: {
href: "http://localhost:8082/accounts/1/users"
},
}
}
Run Code Online (Sandbox Code Playgroud)
PS我看到了这个问题,但我不知道如何在我的情况下使用它(如果它可能的话)
我想知道是否可以添加spring的附加参数,例如-Dspring.profiles.active=prod弹簧启动应用程序,以防将其作为服务运行.
我检查了自动生成的脚本spring-boot-maven-plugin:
command="$javaexe -jar -Dsun.misc.URLClassPath.disableJarChecking=true $jarfile $@"
也许它可以通过maven插件的选项完成,但除了JVM参数之外找不到任何不太有用的...