Answers for "how to get image from resource folder in spring boot in jsp"

0

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) {

        // Register resource handler for images
        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);
    }
}
Posted by: Guest on December-29-2020

Code answers related to "how to get image from resource folder in spring boot in jsp"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language