mirror of https://github.com/usbharu/Hideout.git
feat: messagesをホットリロードに対応
This commit is contained in:
parent
bd219b62e1
commit
533582534f
|
@ -0,0 +1,28 @@
|
|||
package dev.usbharu.hideout.core.config
|
||||
|
||||
import org.springframework.boot.autoconfigure.context.MessageSourceProperties
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.context.MessageSource
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.context.annotation.Profile
|
||||
import org.springframework.context.support.ReloadableResourceBundleMessageSource
|
||||
|
||||
@Configuration
|
||||
@Profile("dev")
|
||||
class MessageSourceConfig {
|
||||
@Bean
|
||||
fun messageSource(messageSourceProperties: MessageSourceProperties): MessageSource {
|
||||
val reloadableResourceBundleMessageSource = ReloadableResourceBundleMessageSource()
|
||||
reloadableResourceBundleMessageSource.setBasename("classpath:" + messageSourceProperties.basename)
|
||||
reloadableResourceBundleMessageSource.setCacheSeconds(0)
|
||||
return reloadableResourceBundleMessageSource
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Profile("dev")
|
||||
@ConfigurationProperties(prefix = "spring.messages")
|
||||
fun messageSourceProperties(): MessageSourceProperties {
|
||||
return MessageSourceProperties()
|
||||
}
|
||||
}
|
|
@ -29,7 +29,8 @@ spring:
|
|||
virtual:
|
||||
enabled: true
|
||||
messages:
|
||||
basename: messages.hideout-web-messages
|
||||
basename: messages/hideout-web-messages
|
||||
cache-duration: -1
|
||||
thymeleaf:
|
||||
cache: false
|
||||
server:
|
||||
|
|
Loading…
Reference in New Issue