草庐IT

boot_completed

全部标签

Spring Boot yml ResourceBundle 文件

我正在使用Spring的MessageSource从类路径中的.properties文件中加载错误消息。我的属性尊重某个"template",例如{Object}.{field}.{unrespectedConstraint}示例:userRegistrationDto.password.Size=Lemotdepassedoitavoirauminimum6caractères.userRegistrationDto.email.ValidEmail=Mercidesaisiruneaddressemailvalide.在重构的情况下(例如更改类的名称),我必须在几个地方更改我的属性

java - 使用 Hibernate 的 Spring Boot 在使用 H2 数据库启动时生成丢弃约束错误

我正在使用spring-boot并且有一个这样配置的H2数据库(在application.properties中)。spring.datasource.url=jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSEspring.datasource.driverClassName=org.h2.Driverspring.datasource.username=saspring.datasource.password=spring.jpa.database-platform=org.hibernate.dialect.H2Diale

java - 使用 Hibernate 的 Spring Boot 在使用 H2 数据库启动时生成丢弃约束错误

我正在使用spring-boot并且有一个这样配置的H2数据库(在application.properties中)。spring.datasource.url=jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSEspring.datasource.driverClassName=org.h2.Driverspring.datasource.username=saspring.datasource.password=spring.jpa.database-platform=org.hibernate.dialect.H2Diale

java - 有没有办法正确集成 spring-batch-admin 和 spring-boot ?

根据documentationspringbatchadmin很容易嵌入到现有的应用程序中。只需复制web.xml和index.jsp然后添加所需的依赖项就足以让它工作。但如果我想在现有的SpringBoot项目中使用它,情况会变得更糟。根据thisexample配置有点hacky,但它有效。直到我尝试在我的配置bean中使用@EnableBatchProcessing注释。然后我得到以下异常。Exceptioninthread"main"org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanw

java - 有没有办法正确集成 spring-batch-admin 和 spring-boot ?

根据documentationspringbatchadmin很容易嵌入到现有的应用程序中。只需复制web.xml和index.jsp然后添加所需的依赖项就足以让它工作。但如果我想在现有的SpringBoot项目中使用它,情况会变得更糟。根据thisexample配置有点hacky,但它有效。直到我尝试在我的配置bean中使用@EnableBatchProcessing注释。然后我得到以下异常。Exceptioninthread"main"org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanw

Java Spring Boot 测试 : How to exclude java configuration class from test context

我有一个带有SpringBoot的JavaWeb应用程序运行测试时我需要排除一些Java配置文件:测试配置(测试运行时需要包含):@TestConfiguration@PropertySource("classpath:otp-test.properties")publicclassTestOTPConfig{}生产配置(测试运行时需要排除):@Configuration@PropertySource("classpath:otp.properties")publicclassOTPConfig{}测试类(带有显式配置类):@RunWith(SpringRunner.class)@Sp

Java Spring Boot 测试 : How to exclude java configuration class from test context

我有一个带有SpringBoot的JavaWeb应用程序运行测试时我需要排除一些Java配置文件:测试配置(测试运行时需要包含):@TestConfiguration@PropertySource("classpath:otp-test.properties")publicclassTestOTPConfig{}生产配置(测试运行时需要排除):@Configuration@PropertySource("classpath:otp.properties")publicclassOTPConfig{}测试类(带有显式配置类):@RunWith(SpringRunner.class)@Sp

java - Gradle 无法解析 org.springframework.boot :spring-boot-gradle-plugin:1. 4.2.RELEASE (repo1.maven.org: Nome o servizio sconosciuto)

我在Jenkins上运行gradle构建时遇到问题:Gradle版本是https://services.gradle.org/distributions/gradle-2.14.1-bin.zipFAILURE:Buildfailedwithanexception.*Whatwentwrong:Aproblemoccurredconfiguringrootproject'myApp'.>Couldnotresolvealldependenciesforconfiguration':classpath'.>Couldnotresolveorg.springframework.boot:s

java - Gradle 无法解析 org.springframework.boot :spring-boot-gradle-plugin:1. 4.2.RELEASE (repo1.maven.org: Nome o servizio sconosciuto)

我在Jenkins上运行gradle构建时遇到问题:Gradle版本是https://services.gradle.org/distributions/gradle-2.14.1-bin.zipFAILURE:Buildfailedwithanexception.*Whatwentwrong:Aproblemoccurredconfiguringrootproject'myApp'.>Couldnotresolvealldependenciesforconfiguration':classpath'.>Couldnotresolveorg.springframework.boot:s

java - 如何防止嵌入式netty服务器从spring-boot-starter-webflux启动?

我想使用Springs新的响应式webflux扩展在客户端和服务器应用程序之间建立通信。对于依赖管理,我使用gradle。我在服务器端以及客户端的build.gradle文件基本上是:buildscript{repositories{mavenCentral()maven{url"https://repo.spring.io/snapshot"}}dependencies{classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.BUILD-SNAPSHOT")}}repositories{mavenCent