mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-21 07:15:49 +00:00
Merge pull request #8 from cloudogu/feature/gop_praxis_example
Feature/gop praxis example
This commit is contained in:
commit
54c506a6a3
1 changed files with 18 additions and 0 deletions
|
@ -16,8 +16,12 @@
|
||||||
|
|
||||||
package org.springframework.samples.petclinic;
|
package org.springframework.samples.petclinic;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PetClinic Spring Boot Application.
|
* PetClinic Spring Boot Application.
|
||||||
|
@ -28,8 +32,22 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@SpringBootApplication(proxyBeanMethods = false)
|
@SpringBootApplication(proxyBeanMethods = false)
|
||||||
public class PetClinicApplication {
|
public class PetClinicApplication {
|
||||||
|
|
||||||
|
@Value("${spring.messages.basename}")
|
||||||
|
private String messagesBasename;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(PetClinicApplication.class, args);
|
SpringApplication.run(PetClinicApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The spring.messages.basename property in application.properties does not
|
||||||
|
// support external paths like `file:/some/path/messages` so we set the
|
||||||
|
// property with `ReloadableResourceBundleMessageSource` where the `file:`
|
||||||
|
// notation is supported
|
||||||
|
@Bean
|
||||||
|
public MessageSource messageSource() {
|
||||||
|
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
|
||||||
|
messageSource.setBasenames(messagesBasename);
|
||||||
|
return messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue