草庐IT

instance_of

全部标签

java - 如何删除 'Assignment of Parameter ' 变量'不允许'

我正在使用Java编写Controller程序,并使用Sonar检查样式。在我的Sonar中,我有一条错误消息:'AssignmentofParameter'variable'isnotallowed.它所在的线路是:@RequestParam(value="variable",required=false)Stringvariable所以我想知道如何消除该错误,因为我不能在使用该注释时只创建一个setter。编辑我正在使用Eclipse。被打破的规则是ParameterAssignment。@RequestParam(value="variable",required=false)S

java - 什么时候应该使用 Instance<T> 和 Provider<T> 在 CDI 中注入(inject) bean?

我一直在阅读Instance的API文档和Provider,但尚不完全清楚何时应使用它们。以下方法之间有什么区别?@InjectMyBeanbean;@InjectInstancebean;@InjectProviderbean; 最佳答案 Provider是一个由CDI接口(interface)扩展的JSR-330接口(interface)Instance.注入(inject)MyBean,当没有匹配的bean或有多个匹配的bean时,您的应用程序将在启动期间抛出异常。注入(inject)Instance,bean解析委托(del

javax.net.ssl.SSLException : Certificate for <> doesn't match any of the subject alternative names: [] 异常

当我尝试使用Postman访问URL时,它工作正常,通过使用我的个人证书。但是当我使用RestAssured测试用例尝试相同时,它抛出上述异常。配置类publicclassConfiguration{protectedSSLConfigconfig=null;privatestaticfinalLoggerLOG=LoggerFactory.getLogger(Configuration.class);@SuppressWarnings("deprecation")@BeforeClasspublicvoidsetKeystore(){KeyStorekeyStore=null;Key

java - IntelliJ 2017.2 "Deploy applications configured in Tomcat instance"对话框中的 "Run/Debug Configurations"是什么?

在IntelliJUltimate2017.2,在Run/DebugConfigurations对话框中,带有TomcatServer>左边的Local项被选中,exactly复选框DeployapplicationsconfiguredinTomcatinstance是什么意思?此对话框的全部目的是在Tomcat中运行我的应用程序,所以我很困惑。我尝试通过左下方的?图标访问文档,但收到了404error对于itsURL. 最佳答案 此设置控制当从IntelliJIDEA启动Tomcat时,是否将部署您已经存在于TOMCAT_HOM

java - Apache 速度 : Is there a standard way of verifying the correctness of a template from the command line?

我们的网站使用ApacheVelocity模板语言。我们的内容管理系统已经检查了所有生成的XML文档的格式是否正确。我们被要求在将文件推送到实时站点之前检查文档以捕获Velocity语法错误。是否有从命令行验证Velocity模板正确性的标准方法?我准备读取模板路径、初始化速度引擎、解析模板并捕获任何错误asshownonthispage,但如果有一个现成的工具可以获取文件和配置,并吐出任何错误,那么我宁愿使用它。更新这是我最后做的:packagevelocitysample;importjava.io.IOException;importjava.io.StringWriter;im

java - Weblogic BEA-000449 : Closing socket as no data read from it during the configured idle timeout of 5 secs

我已经开始在我的weblogic10日志文件中看到这条消息。我正在运行一个大约有40-350个并发用户的应用程序。我的问题是这个错误的真正含义是什么它将如何影响用户(如果有的话)可能是什么原因造成的谢谢 最佳答案 WhatdoesthiserrorreallymeanWeblogic正在关闭用于与其中一个服务器客户端通信的套接字,因为超过五秒没有发送数据,这是您为Weblogic的空闲超时配置的值。Whatcouldbecausingthis客户端程序连接到您的服务器,发送一些数据,然后1)不关闭连接或2)消失。

java : execute a method over a maximum period of time

我正在使用JavaMailAPI,Folder类中有一个名为“搜索”的方法,有时执行时间过长。我想要的是在最长的时间段内执行此方法(例如最多15秒),这样我可以确定此方法不会运行超过15秒。伪代码messages=maximumMethod(Folder.search(),15);是否必须创建一个线程来执行此方法并在主线程中使用wait方法? 最佳答案 最好的方法是创建一个单线程的executor你可以用它提交可调用文件。返回值为Future你可以从中得到结果。你也可以说等待这么久才能得到结果。这是示例代码:ExecutorServ

Java "Jackson"JsonMappingException : Can not deserialize instance of float out of FIELD_NAME token

与这个类:publicclassProductsimplementsSerializable{privateBigDecimalproductId;privatefloatpriority;publicfloatgetPriority(){returnpriority;}publicvoidsetPriority(floatpriority){this.priority=priority;}}在对此类JSON数据进行反序列化时:{"productId":47552,"priority":78}出现这个错误:org.codehaus.jackson.map.JsonMappingExce

Java jackson : Parsing a csv file into an object containing a List of objects

我正在尝试使用JacksonCsvParser将一个csv文件解析为一个对象,该对象还包含另一个类的列表。因此前两列包含需要绑定(bind)到父类的数据,之后的数据需要绑定(bind)到另一个类。publicclassPerson{privateStringname;privateStringage;privateListcarDetails;//Getters+setters}publicclassCarDetails{privateStringcarMake;privateStringcarRegistration;//Getters+setters}要解析的日志如下所示:John

java - 错误 : can only iterate over an array or an instance of java. lang.Iterable

请帮助我解决我的错误似乎无法使其工作,因为它只能迭代数组或java.lang.Iterable的实例。我想创建一个条形码并读取它并将其添加到word文档中更新帖子nodeCollection来自com.aspose.words。importcom.aspose.barcode.*;importcom.aspose.barcoderecognition.BarCodeReadType;importcom.aspose.barcoderecognition.BarCodeReader;importcom.aspose.words.Document;importcom.aspose.word