应用程序在版本 2.2.6 下正常工作,但随着应用程序升级到最新版本的 spring boot 2.3.0,它停止工作并在启动过程中失败。
2020-05-20T08:43:04.408+01:00 [APP/PROC/WEB/0] [OUT] 2020-05-20 07:43:04.407 ERROR 15 --- [ main] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'webMvcMetricsFilter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcMetricsFilter' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compositeMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/CompositeMeterRegistryConfiguration.class]: Unsatisfied dependency expressed through method 'compositeMeterRegistry' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'prometheusMeterRegistry' defined …
我正在尝试在 Spring Boot 2.2 中使用 Hibernate 配置 EHCache,但似乎我做错了什么。我查看了几个教程和 SO 问题,但没有找到与我的方法完全匹配的内容。
我为缓存选择了无 XML、jcache 配置的方法。但是,Hibernate 没有检测到现有的缓存管理器(我检查甚至强制执行@AutoconfigureBefore:缓存管理器在 Hibernate 自动配置之前加载)。结果,Hibernate 创建了第二个EhcacheManager并抛出了几个警告,例如:
HHH90001006: Missing cache[com.example.demo.one.dto.MyModel] was created on-the-fly. The created cache will use a provider-specific default configuration: make sure you defined one. You can disable this warning by setting 'hibernate.javax.cache.missing_cache_strategy' to 'create'.
Run Code Online (Sandbox Code Playgroud)
我尝试使用 aHibernatePropertiesCustomizer来告诉 Hibernate 它应该使用哪个缓存管理器。bean 已实例化,但从未被调用,因此它失去了所有吸引力和用途。
有人知道我做错了什么以及我应该如何让 Hibernate 使用我已经配置的缓存管理器而不是创建自己的缓存管理器吗?
我将我的配置与JHipster生成的配置进行了比较。它看起来非常相似,尽管它们HibernatePropertiesCustomizer 被称为。我没有成功确定他们的缓存配置和我的缓存配置之间的差异。
这似乎与我的数据源配置有关(请参阅下面的代码)。我尝试删除它并以更简单的方式启用我的 JPA 配置,并且HibernatePropertiesCustomizer确实按预期调用。
HHH90001006: Missing cache[com.example.demo.one.dto.MyModel] was …Run Code Online (Sandbox Code Playgroud) 当我尝试执行mvn clean install. 作为构建的一部分,我们编译多个组件,最后使用wiremock 执行功能测试。它应该从功能测试配置文件中选择特定配置,并且应该从 application.properties 文件中选择默认属性。但由于某种原因,相同的代码无法找到这些文件中提到的属性。所以,只是想知道是否可以以某种方式获取在wiremock 期间加载的属性文件列表?这将提供一些线索,说明为什么没有选择预期的属性文件?
所有属性文件都位于内部:
src/main/resources
Run Code Online (Sandbox Code Playgroud)
并且,从测试课开始。
@ContextConfiguration(classes = SampleFTConfiguration.class)
public class SampleControllerTest{
//test method
}
@ComponentScan("com.xxx.xxx.xxx.ft")
@PropertySource("classpath:application-test.properties")
public class SampleFTConfiguration{
}
Run Code Online (Sandbox Code Playgroud)
注意:我不希望任何人解决这个问题,我只想知道,我们是否可以获得加载的属性文件的名称?
“hikaricp.connections. ”和“jdbc.connections. ”仪表名称之间有什么区别?我有一个 Spring Boot 2 应用程序,默认使用 Hikari 连接池机制,我试图了解如何最好地监视生产中的数据库连接。在 Datadog 中可视化我的指标后,我发现 hikariCP.connections.active 和 jdbc.connections.active 的指标数据略有不同。
JDBC 计量表名称是否重复?是否应该使用其中一个而不是另一个,或者这并不重要。我一直在努力寻找这方面更详细的文档。任何帮助深表感谢。
我一直在使用 mvn spring-boot:run 命令和 -Dspring-boot.run.arguments 将参数/变量传递给我们的 spring-boot 应用程序,例如:
mvn spring-boot:run -Dspring-boot.run.arguments=--jwt.validateExp=false,--jwt.skipValidation=true
Run Code Online (Sandbox Code Playgroud)
在应用程序中,我曾经使用注释读取参数值:@Value("${jwt.skipValidation}")。这在 spring-boot 2.2.1 中运行良好。
当我升级到 spring-boot 2.3.1 时,它停止工作。有什么建议吗?
当我更改 /templates 中的 thymeleaf .html 文件时,我希望浏览器自动重新加载页面。我安装了实时重新加载插件,它能够与 Spring Boot 服务器握手。但是,在更改 thymeleaf 模板文件时,我必须手动重新加载浏览器。任何我可能缺少的建议。显然我已经spring-boot-devtools启用并手动更新了属性devtools.livereload.enabled = true。并且 spring devtools 正确地反映了对构建目标中任何模板或控制器的更改,并且通过手动重新加载浏览器,我看到了更改。
根据 spring 文档。
某些资源在更改时不一定需要触发重新启动。例如,可以就地编辑 Thymeleaf 模板。默认情况下,更改 /META-INF/maven、/META-INF/resources、/resources、/static、/public 或 /templates 中的资源不会触发重新启动,但会触发实时重新加载。
我让我的本地运行在损坏的 https 上。(某些证书问题,这会导致not securechrome 地址栏中出现一条消息。这可能是实时重新加载不起作用的原因。
spring thymeleaf livereload spring-boot-devtools spring-boot-2
我在 Java 11 中使用 Spring Boot 2.1。我正在使用 Maven 来构建我的工件。在本地运行时,我喜欢 Spring JPA 指令,它让我自动创建数据库......
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.show-sql=true
Run Code Online (Sandbox Code Playgroud)
我也喜欢让我自动创建文件的指令......
spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata
spring.jpa.properties.javax.persistence.schema-generation.scripts.action=update
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=update.sql
Run Code Online (Sandbox Code Playgroud)
然而,当我在我的 src/main/resources/application.properties 中结合两者时......
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.hibernate.show-sql=true
spring.jpa.properties.javax.persistence.validation.mode=none
spring.datasource.url=jdbc:postgresql://${PG_DB_HOST:localhost}:5432/${PG_DB_NAME}
spring.datasource.username=${PG_DB_USER}
spring.datasource.password=${PG_DB_PASS}
spring.jpa.properties.javax.persistence.schema-generation.create-source=metadata
spring.jpa.properties.javax.persistence.schema-generation.scripts.action=update
spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=update.sql
Run Code Online (Sandbox Code Playgroud)
似乎“spring.jpa.properties.javax.persistence”优先,我的架构更改不会针对数据库自动运行。有没有办法配置同时发生的事情——更改被记录到文件中并自动针对我的数据库运行?
我正在使用弹簧靴 2.3.2。在执行器的帮助下,将应用程序指标发布到指标控制台。我想知道执行器抛光的指标system.cpu.usage和process.cpu.usage指标之间有什么区别。
spring-boot spring-boot-actuator micrometer spring-micrometer spring-boot-2
如何在 Spring Webflux 中获取引用网址?我尝试查看ServerWebExchange exchange对象中的标头属性,但找不到相同的属性。有人可以帮我吗?
我正在将我的项目从 springboot 1.5.7 升级到 2.1.6 ,经过一些修改和更正编译错误后,一切看起来都很好。
当我尝试一些测试用例来保存对象并使用@procedure 返回一列时,我看到以下错误
org.springframework.dao.InvalidDataAccessApiiUsageException: OUT/INOUT parameter not available: serviceRequestId; nested exception is java.lang.IllegalArgumentException: OUT/INOUT parameter not available
Run Code Online (Sandbox Code Playgroud)
下面是我的存储库类:
public interface ServiceRequestRepository extends CrudRepository<ServiceRequest, Long> {
@Procedure(name = "saveServiceRequest")
long saveServiceRequest(@Param("payloadIn") String payloadIn,
@Param("action") String action,
@Param("orderId") String orderId,
@Param("status") String status);
}
Run Code Online (Sandbox Code Playgroud)
这是我的 ServiceRequestSnapshot
@Entity
@Table(name = "service_request")
@NamedStoredProcedureQueries({
@NamedStoredProcedureQuery(name = "saveServiceRequest",
procedureName = "service_request_pkg.saveServiceRequest",
parameters = {
@StoredProcedureParameter(mode = ParameterMode.IN, name = "payloadIn", type = String.class),
@StoredProcedureParameter(mode = ParameterMode.IN, name = "action", type = …Run Code Online (Sandbox Code Playgroud) spring-boot-2 ×10
spring-boot ×5
java ×4
ehcache-3 ×1
hibernate ×1
hikaricp ×1
jcache ×1
jdbc ×1
jpa ×1
livereload ×1
maven ×1
micrometer ×1
monitoring ×1
prometheus ×1
spring ×1
spring5 ×1
thymeleaf ×1
wiremock ×1