Bir Spring Boot (v1.3.6) tek sayfalık uygulama (angular2) var ve tüm isteği index.html
'a iletmek istiyorum.Yay önyükleme tek sayfa uygulaması - her isteği index.html'ye iletme
http://localhost:8080/index.html için bir istek çalışıyor (200 ve ben index.html olsun) ama http://localhost:8080/home (404) değil.
Runner.class
@SpringBootApplication
@ComponentScan({"packagea.packageb"})
@EnableAutoConfiguration
public class Runner {
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext run = SpringApplication.run(Runner.class, args);
}
}
WebAppConfig.class
@Configuration
@EnableScheduling
@EnableAsync
public class WebAppConfig extends WebMvcConfigurationSupport {
private static final int CACHE_PERIOD_ONE_YEAR = 31536000;
private static final int CACHE_PERIOD_NO_CACHE = 0;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.setOrder(-1);
registry.addResourceHandler("/styles.css").addResourceLocations("/styles.css").setCachePeriod(CACHE_PERIOD_ONE_YEAR);
registry.addResourceHandler("/app/third-party/**").addResourceLocations("/node_modules/").setCachePeriod(CACHE_PERIOD_ONE_YEAR);
registry.addResourceHandler("/app/**").addResourceLocations("/app/").setCachePeriod(CACHE_PERIOD_NO_CACHE);
registry.addResourceHandler("/systemjs.config.js").addResourceLocations("/systemjs.config.js").setCachePeriod(CACHE_PERIOD_NO_CACHE);
registry.addResourceHandler("/**").addResourceLocations("/index.html").setCachePeriod(CACHE_PERIOD_NO_CACHE);
}
}
styles.css
, /app/third-party/xyz/xyz.js
, .. (200 ve ben doğru dosya olsun) çalışıyoruz. Sadece /**
- index.html
çalışmıyor.
belki index.html korumalı bir klasörde veya içindedir diğer yol? – duardito
@duardito 'index.html' aynı klasörde (' webapp') 'styles.css' olarak – Christoph
"/home "ile eşleşen bir son nokta var mı? – duardito