enable static resource versioning in Spring Boot with Spring MVC

  • Durum: Pending
  • Ödül: $15
  • Alınan Girdiler: 0

Yarışma Özeti

I need help enabling static resource versioning.
Here is my current code, which is not working:

@Bean
public FilterRegistrationBean<?> resourceUrlEncodingFilterRegistration() {
FilterRegistrationBean<ResourceUrlEncodingFilter> registration = new FilterRegistrationBean<>();
[login to view URL](new ResourceUrlEncodingFilter());
[login to view URL]("/*");
return registration;
}

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
[login to view URL]("/clientlibs/**")
.addResourceLocations("classpath:/clientlibs/", "classpath:/")
.setCacheControl([login to view URL](1, [login to view URL]))
.resourceChain(true)
.addResolver(new VersionResourceResolver()
.addContentVersionStrategy("/**"))
.addTransformer(new CssLinkResourceTransformer());
}

I am posting this as a competition. The first freelancer to provide a usable solution will be awarded.

İstenilen Beceriler

Genel Açıklama Panosu

  • Yashzode
    Yashzode
    • 4 hafta önce

    Here is the my solution.I debug source code of Spring.ServletContextResource class create a relativeRelative.Then check whether resource is exists.

    • 4 hafta önce
    1. Yashzode
      Yashzode
      • 4 hafta önce

      registry.addResourceHandler("/css*//**").addResourceLocations("/resources/static/")
      .setCacheControl(CacheControl.maxAge(365, TimeUnit.DAYS))
      .resourceChain(false)
      .addResolver(new VersionResourceResolver().addContentVersionStrategy("/**"))
      .addTransformer(new CssLinkResourceTransformer());
      registry.addResourceHandler("/js*//**").addResourceLocations("/resources/static/")
      .setCacheControl(CacheControl.maxAge(365, TimeUnit.DAYS))
      .resourceChain(false)
      .addResolver(new VersionResourceResolver().addContentVersionStrategy("/**"))
      .addTransformer(new CssLinkResourceTransformer());

      • 4 hafta önce
    2. Yashzode
      Yashzode
      • 4 hafta önce

      @Override
      public void configure(final WebSecurity web) throws Exception {
      web.ignoring().antMatchers("/theme/**").antMatchers("/js/**").antMatchers("/css/**");
      }

      • 4 hafta önce

Yarışmalara nasıl başlanır

  • Projenizi ilan edin

    Yarışmanızı İlan Edin Hızlı ve kolay

  • Tonlarca girdi alın

    Tonlarca Girdi Alın Bütün dünyadan

  • En iyi girdiyi seçin

    En iyi girdiyi seçin Dosyaları indirin - Kolay!

Şimdi bir Yarışma İlan Et ya da Bugün Bize Katılın!