package com.jh.radegast;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.LocaleResolver;

import com.jh.common.template.ThymeleafTemplateService;
import com.jh.common.web.FallbackLocaleResolver;

@SpringBootApplication
@EnableJpaRepositories
@EnableAsync
@EnableScheduling
@EnableCaching
@ComponentScan(basePackages = {"com.jh"})
public class RateItApplication {

    public static void main(String[] args) {
        SpringApplication.run(RateItApplication.class, args);
    }

    
    //hack :-(
	@Bean
	@Primary
	public LocaleResolver localeResolver() {
		return new FallbackLocaleResolver();
	}

	@Bean
	public ThymeleafTemplateService templateService() {
		return new ThymeleafTemplateService();
	}

}

