spring boot get image from resources code example
Example: spring boot access images in resources folder
@SpringBootApplication
public class MainApplication implements WebMvcConfigurer {
private static Logger logger = LoggerFactory.getLogger(MainApplication.class.getName());
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/images/**").addResourceLocations("/WEB-INF/images/")
.setCacheControl(CacheControl.maxAge(2, TimeUnit.HOURS).cachePublic());
}
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
}