草庐IT

Application_name

全部标签

java - spring - 从 application.properties 文件中读取环境变量

我在application.properties文件中指定了Spring属性。我如何从环境变量中填充这些属性?这是我试过的,但似乎不起作用:application.propertiesspring.datasource.url=jdbc:postgresql://#{systemProperties['DATABASE_HOST']}:5432/dbnamespring.datasource.username=postgresspring.datasource.password=postgres 最佳答案 您可以像使用${...}语

java - 解决 Java Checkstyle 错误 : Name 'logger' must match pattern '^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'

使用EclipseCheckstyle插件我看到这个错误:Name'logger'mustmatchpattern'^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$'.我通过更改解决了这个错误:privatestaticfinalLoggerlogger=Logger.getLogger(someClass.class);到privatestaticfinalLoggerLOGGER=Logger.getLogger(someClass.class);为什么这是一个checkstyle警告? 最佳答案 因为该字段被标记为f

java - application.properties 中的 SpringBoot 未知属性

我使用嵌入式Tomcat+Thymeleaf模板引擎,使用SpringInitializr生成了一个SpringBootWeb应用程序。我把这个属性放在我的application.properties中default.to.address=nunito.calzada@gmail.com我正在使用SpringToolSuiteVersion:3.8.4.RELEASE作为开发环境,但我在编辑器中收到此警告'default.to.address'isanunknownproperty.我应该把这个属性放在另一个属性文件中吗? 最佳答案

java.sql.SQLException : Invalid column name 异常

我不明白为什么我会在此处收到“无效的列名”。我们已经在Oracle中直接尝试了sql的一个变体,它工作正常,但是当我使用jdbcTemplate尝试它时,出现了问题。ListalleXmler=jdbcTemplate.query("selectp.applicationid,x.datadocumentid,x.datadocumentxml"+"fromCFUSERENGINE51.PROCESSENGINEp"+"leftjoinCFUSERENGINE51.DATADOCUMENTXMLx"+"onp.processengineguid=x.processengineguid"

java - eclipse 链接 : No Persistence provider for EntityManager named

我想创建一个能够使用JavaPersistence的Bundle。为此,我在Eclipse中创建了一个插件项目。在我的项目中,我在META-INF中创建了一个persistence.xml文件。我已经在我的MANIFEST.mf中添加了这3个包(到依赖项中):javax.persistence.jarorg.eclipse.persistence.jarorg.eclipse.persistence.jar然后,在我的Activator中,我使用以下行创建一个EntityManager:factory=Persistence.createEntityManagerFactory(PER

Java 错误 : Should be declared in a file named

我是Java的新手,正在尝试找出解决以下错误的方法:错误读取CalculatorWithMemory.java:1:classCalculatorispublic,shouldbedeclaredinafilenamedCalculator.javapublicclassCalculator所以我的想法是,这意味着我必须保存2个不同的.java文件。然而,这是一个类,我只有一个提供的文本block来输入我的解决方案,所以我不能将它们保存为.java文件。任何关于解决方案的想法都会很棒。提前致谢!提供所有信息。我正在尝试解决以下问题。问题父类(superclass)计算器包含:一个(pr

java - tomcat启动报错: DB name not found

在启动Tomcat时,出现以下错误:SEVERE:ExceptionlookingupUserDatabaseunderkeyUserDatabasejavax.naming.NameNotFoundException:NameUserDatabaseisnotboundinthisContextatorg.apache.naming.NamingContext.lookup(NamingContext.java:770)atorg.apache.naming.NamingContext.lookup(NamingContext.java:153)atorg.apache.catali

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

java.lang.ClassFormatError : Duplicate method name&signature in class file 错误

我们正在将我们的应用程序从Weblogic10.3.0升级到10.3.6。当我们尝试部署它时,我们收到错误:java.lang.ClassFormatError:Duplicatemethodname&signatureinclassfile...经过进一步调查,我们发现问题是由如下代码引起的:interfaceFoo{voidfoo();}interfaceBar{voidfoo();}interfaceBazextendsFoo,Bar{}BazEJBimplementsBaz....这会导致在Baz中生成2个foo方法....ELOImpl.class,这会在我们尝试部署ear文

java - Spring Security 5 在 Application Runner 中调用 OAuth2 Secured API 导致 IllegalArgumentException

给定以下代码,是否可以在应用程序运行器中调用受客户端凭据保护的API?@BeanpublicApplicationRunnertest(WebClient.Builderbuilder,ClientRegistrationRepositoryclientRegistrationRepo,OAuth2AuthorizedClientRepositoryauthorizedClient){returnargs->{try{varoauth2=newServletOAuth2AuthorizedClientExchangeFilterFunction(clientRegistrationRe