草庐IT

data_utils

全部标签

java - org.codehaus.plexus.component.repository.exception.ComponentLookupException : java. util.NoSuchElementException

我尝试测试我的Maven插件并收到奇怪的异常。发现类似问题here,但答案没有帮助。pom.xmlorg.apache.mavenmaven-plugin-api3.3.9org.apache.mavenmaven-project3.0-alpha-2com.jcabijcabi-aether0.10.1org.apache.maven.plugin-toolsmaven-plugin-annotations3.4providedorg.apache.maven.plugin-testingmaven-plugin-testing-harness3.3.0testorg.apache.

java - 有关 web.xml 中的 <data-source> 标记的更多信息

我一直在寻找关于JavaEE应用程序的数据源配置的标准,但我在Internet上找到的所有内容都是特定于容器的(例如:context.xmlTomcat)。我找到了thisveryraresubject关于标签。看里面的链接,很有意思。我无法在Sun/Oracle文档中找到更多信息。所以我有几个问题:标签适用于所有网络服务器?(Tomcat,JBoss)多个资源:我们可以拥有多个吗web.xml中的标记?我们必须使用吗?当我们使用时web.xml中的标记(用于@Resource注释)标签,还是没有必要?当我们用“InitialContext”或“@Resource”,每次调用都是相同的

java - 通过使用 java.util.Date 可能出现下溢错误

这段代码:packagetest;importjava.util.Date;publicclassDateUnderflow{publicstaticvoidmain(String[]args){Longtimestamp=-8120649749785140250L;System.out.println(newDate(timestamp));}}产生以下输出:"SatAug0310:00:59CET257325894"怎么会?无一异常(exception)的下溢?Doc说Date(longdate)的date参数是自纪元以来的毫秒数,所以我有点惊讶地发现自己如此深入future..我

java - Spring Data Rest JPA - 无法延迟加载 OneToMany 双向关系

我有两个实体,Company和Job,具有OneToMany双向关系。我的问题是我不能延迟加载公司的Listjobs.例如当我这样做时:获取/api/companies/1这是JSON响应:{"id":1,"name":"foo",..."_embedded":{"jobs":[{...},...{...}],"employees":[{...},{...}]},"_links":{"self":{"href":"http://localhost:8080/api/companies/1"},"jobs":{"href":"http://localhost:8080/api/compa

java - 我是否发现了 java.util.Calendar 错误?

我有以下测试:importstaticorg.junit.Assert.assertEquals;importjava.text.SimpleDateFormat;importjava.util.Calendar;importjava.util.TimeZone;importorg.junit.Test;publicclassCalendarBug{privatestaticfinalTimeZoneUTC_ZONE=TimeZone.getTimeZone("UTC");//+0hoursprivatestaticfinalTimeZoneIST_ZONE=TimeZone.getT

java - 如何在附加条件下使用 Spring Data JPA 示例匹配器

我正在尝试使用SpringJPA的示例来进行搜索。有了下面的代码,大部分都符合要求。publicPagefindShops(Shopcondition,Pageablepageable){ExampleMatchermatcher=ExampleMatcher.matching().withStringMatcher(StringMatcher.CONTAINING).withIgnoreCase();returnshopDao.findAll(Example.of(condition,matcher),pageable);}此外,我只需要状态不等于DELETED的SHOP。比如,.w

java - Spring Data Jpa - 扫描测试文件夹中的文件

我正在使用SpringDataJPA,这很奇怪,但它会尝试扫描(在部署期间)测试文件,这会导致错误:java.lang.ClassNotFoundException:org.junit.runner.RunWithatorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)atorg.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)...WARN:org.springf

java - 为什么 java.util.Set 不包含值 getter ?有替代品吗?

由于集合条目仅通过属性子集(hashCode()+equals())进行区分,因此有时需要对集合中包含的原始对象进行操作,这对于java.util.Set是不可能的。.我想到的唯一选择是:Map-不是一个非常简洁的解决方案。集合框架中还有其他替代方案吗?要求是:O(1)获取时间并且没有基于hashCode()+equals()的重复项结果。 最佳答案 如果再执行一次O(1)操作没有问题,您可以模拟缺少方法get(Object)用一对方法set.remove(Object)和set.add(Object).否则,我会使用Map正如您提

java - 按类类型加载数据的通用 Spring Data JPA 存储库实现

我正在使用SpringDataJPA1.4.3.RELEASE和Hibernate4.2.7.Final我能够成功地创建一个BaseRepository类,类似于:http://docs.spring.io/spring-data/jpa/docs/1.4.2.RELEASE/reference/html/repositories.html#repositories.custom-behaviour-for-all-repositories@NoRepositoryBeanpublicinterfaceBaseRepositoryextendsJpaRepository@NoRepos

java - 使用 Spring Data Rest 在集合上公开超媒体链接,即使它是空的

首先我阅读了上一个问题:ExposinglinkoncollectionentityinspringdataREST但问题依然存在,没有任何技巧。事实上,如果我想公开一个集合资源的链接,我正在使用以下代码:@ComponentpublicclassFooProcessorimplementsResourceProcessor>>{privatefinalFooLinksfooLinks;@InjectpublicFooProcessor(FooLinksfooLinks){this.FooLinks=fooLinks;}@OverridepublicPagedResources>pro