草庐IT

get_declared_classes

全部标签

Java 8 : Get files from folder/subfolder

这个问题在这里已经有了答案:Recursivelylistallfileswithinadirectoryusingnio.file.DirectoryStream;(9个回答)关闭4年前。我在SpringBoot应用程序的资源文件夹中有这个文件夹。resources/files/a.txtresources/files/b/b1.txtresources/files/b/b2.txtresources/files/c/c1.txtresources/files/c/c2.txt我想获取所有的txt文件,所以这是我的代码:ClassLoaderclassLoader=this.getC

java - 配置问题 : spring-security-web classes are not available. 你需要这些才能使用 <filter-chain-map>

我正在尝试使用Maven在我的springweb应用程序上运行一些单元测试。该应用程序安装并运行良好,它生成一个可部署的war文件一切正常(全部使用Maven)。我的测试类(位于src/test/java):@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration(locations={"file:C:/myProjects/myWebapp/src/main/webapp/WEB-INF/applicationContext-test.xml"})@TransactionalpublicclassMyTest{...但是

java - 如何在 Scala 中获取 Java 的 int.class?

我正在使用Scala来处理Java的反射API。但我似乎无法弄清楚如何在Scala中访问Java中的内容:int.class、float.class、boolean.class。基本上是表示原始数据类型的类对象。那么int.class的Scala版本是什么? 最佳答案 int.class、float.class等不存在。每个等效的装箱类型都有一个名为TYPE的静态字段,它表示原始类型。这是你的意思吗?例如对于整数/整数:http://docs.oracle.com/javase/6/docs/api/java/lang/Intege

Java/Servlet : get current sql. 日期

我需要做的是:1)从请求中获取用户的语言环境。2)根据用户的区域设置,使用当前日期和时间创建新的sql.Date对象3)写入MySQLdb,列类型:TIMESTAMP我得到的是:java.util.Localelocale=request.getLocale();java.text.DateFormatdateFormat=java.text.DateFormat.getDateTimeInstance(java.text.DateFormat.LONG,java.text.DateFormat.LONG,locale);java.util.Datedate=newjava.util.

java - 调用 'Class.forName' 时未检查转换警告

我的代码如下packagecom.foo;publicclassTestComposition{publicstaticvoidmain(String[]args){try{ClassfooClass=(Class)Class.forName("Foo");}catch(ClassNotFoundExceptione){e.printStackTrace();}}}“try”block中的赋值会导致警告Typesafety:UncheckedcastfromClasstoClass这是为什么? 最佳答案 首先,如果您知道确切的类,则

java - Maven "class file for ... not found"编译错误

我有一个Maven项目。当我尝试使用Maven构建它时,出现此错误:[ERROR]Failedtoexecutegoalorg.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile(default-compile)onprojectmyProject:Compilationfailure:Compilationfailure:[ERROR]ClassA.java:[32,38]cannotaccessClassB[ERROR]classfileforClassBnotfoundClassB位于另一个Artifact内,该Art

java - 双代理接口(interface) : Could not generate CGLIB subclass of class 时 Spring AspectJ 失败

我正在使用Spring的代理一些JPArepository接口(interface)。但是,代理失败并显示以下Cannotsubclassfinalclassclass$Proxy80:CouldnotgenerateCGLIBsubclassofclass[class$Proxy80]:Commoncausesofthisproblemincludeusingafinalclassoranon-visibleclass;nestedexceptionisjava.lang.IllegalArgumentException:Cannotsubclassfinalclassclass$P

java - NoClassDefFoundError : Unable to load class groovy. xml.jaxb.JaxbGroovyMethods 由于缺少依赖项 javax/xml/bind/Unmarshaller

关闭。这个问题是notreproducibleorwascausedbytypos.它目前不接受答案。这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助future的读者。关闭4年前。Improvethisquestion我们的Gradle构建有--add-modules=java.xml.bind,java.activation,java.xml.ws.annotation至options.compilerArgs在JavaCompile使用JDK9/10构建。现在效果很好,但这些模块已被弃用。我想为JDK11做准

java - 如何强制派生类在多层调用父类(super class)方法?

我正在尝试找到最优雅的方式来让child和parent对祖parent发起的事件使用react。这是一个天真的解决方案:abstractclassA{finalpublicvoidfoo(){//SomestuffhereonFoo();}protectedabstractvoidonFoo();}abstractclassBextendsA{@OverridefinalprotectedvoidonFoo(){//MorestuffhereonOnFoo();}protectedabstractvoidonOnFoo();}classCextendsB{@Overrideprotec

Java邮件 : get size of a MimeMessage

我正在尝试获取MimeMessage的大小。getSize()方法总是简单地返回-1。这是我的代码:MimeMessagem=newMimeMessage(session);m.setFrom(newInternetAddress(fromAddress,true));m.setRecipient(RecipientType.TO,newInternetAddress(toAddress,true));m.setSubject(subject);MimeBodyPartbodyPart=newMimeBodyPart();bodyPart.setContent(body,"text/h