Created
October 22, 2020 14:28
-
-
Save hoangnt-2197/c816e0504a502bb213e287a8418fdacd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
@Configuration | |
@EnableConfigurationProperties(KnoteProperties.class) | |
class KnoteConfig implements WebMvcConfigurer { | |
@Autowired | |
private KnoteProperties properties; | |
@Override | |
public void addResourceHandlers(ResourceHandlerRegistry registry) { | |
registry | |
.addResourceHandler("/uploads/**") | |
.addResourceLocations("file:" + properties.getUploadDir()) | |
.setCachePeriod(3600) | |
.resourceChain(true) | |
.addResolver(new PathResourceResolver()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment