草庐IT

The_constant_pool

全部标签

java - Java 导入语句错误 "The import javax.validation.constraints.NotNull cannot be resolved"

在开发Springroo项目后,发现类中有如下错误:Theimportjavax.validation.constraints.NotNullcannotberesolvedNotNullcannotberesolvedtoatype我正在使用STS3.1.0.RELEASE如何解决这个问题? 最佳答案 我遇到了同样的问题。我发现最新版本的SpringBoot需要单独的验证依赖项。我尝试在pom.xml文件中添加以下依赖项并且它起作用了。org.springframework.bootspring-boot-starter-vali

hibernate 中的 Javassist 失败 : invalid constant type: 60

我正在创建一个cli工具来管理现有的应用程序。应用程序和测试都构建良好并运行良好,但尽管我在运行jar中存在的cli工具时收到javassist失败:INFO:Bytecodeprovidername:javassist...INFO:HibernateEntityManager3.5.1-FinalExceptioninthread"main"javax.persistence.PersistenceException:UnabletoconfigureEntityManagerFactoryatorg.hibernate.ejb.Ejb3Configuration.configur

java - "the hash table is open"在Java中是什么意思?

我在阅读有关Hashtable类的Javaapi文档时遇到了几个问题。在文档中,它说“Notethatthehashtableisopen:inthecaseofa"hashcollision",asinglebucketstoresmultipleentries,whichmustbesearchedsequentially.”我自己尝试了以下代码Hashtableme=newHashtable();me.put("one",newInteger(1));me.put("two",newInteger(2));me.put("two",newInteger(3));System.ou

java - Apache Commons Pool 2 中的 maxTotal 和 maxIdle 有什么区别?

我正在使用ApacheCommonsPool2实现来为我的应用程序提供对象池机制。到目前为止,我已经在我的代码中将maxTotal()和maxIdle()的默认值设置为10。但是我不明白它们之间有什么区别?如果我将maxIdle()设置为非常小(比如0)或非常大(等于maxTotal())的值会怎样?注意:Apache类在内部建议对上述两个配置使用默认值8。 最佳答案 连接池是一种与无限数量的并发用户共享有限数量的数据库连接的技术。最大总连接数(maxTotal)包括Activity连接数和空闲连接数,即正在使用的连接数和当前未使用

java - 加入获取 : "query specified join fetching, but the owner of the fetched association was not present in the select list"

我有以下代码:publicclassValueDAOimplementsBusinessObject{privateLongid;privateStringcode;privateClassDAOclassDAO;....}publicListgetCodesByCodeClass(LongclassId){Stringselect="selectdistinctval.codefromValueDAOvalleft"+"joinfetchval.classDAO";Stringwhere="whereval.classDAO.id=?orderbyval.code";returnge

Java 正则表达式 : Just get a part of the matcher group

我在Java中有一个正则表达式:Patternpattern=Pattern.compile(text.+);Matchermatcher=pattern.matcher(ganzeDatei);while(matcher.find()){Stringstring=matcher.group();...这工作正常,但输出类似于textName但我只想要这个:Name我该怎么做? 最佳答案 通过将其括在括号中来捕获要返回的文本,因此在此示例中,您的正则表达式应变为text(.+)然后您可以访问括号之间匹配的文本matcher.grou

Java 错误 : The constructor is undefined

在Java中,为什么会出现此错误:Error:TheconstructorWeightIn()isundefinedJava代码:publicclassWeightIn{privatedoubleweight;privatedoubleheight;publicWeightIn(doubleweightIn,doubleheightIn){weight=weightIn;height=heightIn;}publicvoidsetWeight(doubleweightIn){weight=weightIn;}publicvoidsetHeight(doubleheightIn){hei

java - Play Framework : PersistenceException: The type is not a registered entity? (Ebean)

我正在学习适用于Java的PlayFramework2.0教程,但在尝试保存ebean模型(task.save())时遇到此错误。[PersistenceException:Thetype[classmodels.Task]isnotaregisteredentity?Ifyoudon'texplicitlylisttheentityclassestouseEbeanwillsearchforthemintheclasspath.IftheentityisinaJarchecktheebean.search.jarspropertyinebean.propertiesfileorche

Java - 编码风格 : What are the cons and pros of "ABC". 等于 ("SOMESTRING") 风格字符串比较?

这个问题在这里已经有了答案:Whatistheproperwaytousea.equalsmethodinJava?(2个答案)关闭9年前。让我先从示例代码开始...Stringpassword="";if("PIRATE".equals(password)){//Dosomething}看这里,字符串常量或字面量(无论什么)“PIRATE”用于检查两个字符串的相等性。而...Stringpassword="";if(password.equals("PIRATE")){//Dosomething}这也与之前的代码完全一样。现在,我看到很多第一种样式"STRING_LITERAL".e

java - 得到一个 The entity name must immediately follow the '&' in the entity reference error in java, 但我的 xml 文件中没有任何符号

我遇到了错误Theentitynamemustimmediatelyfollowthe'&'intheentityreference.但我的XML文档中没有任何符号!有谁知道为什么会发生这种情况?这是我要解析的XML文档:BestiPadstrategygameshttp://feedproxy.google.com/~r/TheIphoneBlog/~3/198mhX3FVmw/story01.htmShareyourlifewithfriendsinrealtimewithSpinhttp://feedproxy.google.com/~r/TheIphoneBlog/~3/9G8