Skip to content

Commit

Permalink
Register the Hibernate validation message bundle (#407)
Browse files Browse the repository at this point in the history
Register the Hibernate validation message bundle, so that messages are interpolated correctly. Fixes #410 .
  • Loading branch information
kevin-wise authored Jun 27, 2024
1 parent 882346e commit df76d3b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright 2017-2024 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.configuration.hibernate.validator;

import io.micronaut.context.annotation.Requires;
import io.micronaut.context.i18n.ResourceBundleMessageSource;
import io.micronaut.core.order.Ordered;
import jakarta.inject.Singleton;

@Singleton
@Requires(resources = "classpath:org/hibernate/validator/ValidationMessages.properties")
public class HibernateMessageBundle extends ResourceBundleMessageSource {
public HibernateMessageBundle() {
super("org.hibernate.validator.ValidationMessages");
}

@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import jakarta.inject.Singleton
*/
class ValidatedBeanSpec extends Specification {

@Issue("https://github.com/micronaut-projects/micronaut-validation/issues/101")
@PendingFeature
void "test validated bean invalid bean"() {
given:
System.setProperty("a.url", "test")
Expand Down

0 comments on commit df76d3b

Please sign in to comment.