mirror of
https://github.com/usbharu/Hideout.git
synced 2026-09-21 11:53:40 +00:00
feat: messagesをホットリロードに対応
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user