55 lines
1.8 KiB
Java
55 lines
1.8 KiB
Java
package application;
|
|
|
|
import application.repositories.RoleRepository;
|
|
import application.repositories.UserRepository;
|
|
import application.utils.TokensGenerator;
|
|
import org.springframework.boot.SpringApplication;
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
import org.springframework.boot.context.web.SpringBootServletInitializer;
|
|
import org.springframework.context.ConfigurableApplicationContext;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.ComponentScan;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.context.annotation.ImportResource;
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
|
import org.springframework.web.servlet.view.JstlView;
|
|
|
|
|
|
/**
|
|
* Created by lukasgol on 01.04.14.
|
|
*/
|
|
@Configuration
|
|
@ComponentScan
|
|
@EnableAutoConfiguration
|
|
@ImportResource("Spring-Module.xml")
|
|
@EnableScheduling
|
|
public class Config extends SpringBootServletInitializer {
|
|
|
|
|
|
@Scheduled(fixedRate = 50000)
|
|
public void generatePassword() {
|
|
TokensGenerator.generatePassword();
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
|
|
ConfigurableApplicationContext context = SpringApplication.run(Config.class, args);
|
|
UserRepository userRepository=context.getBean(UserRepository.class);
|
|
RoleRepository roleRepository=context.getBean(RoleRepository.class);
|
|
}
|
|
|
|
@Bean
|
|
public InternalResourceViewResolver internalResourceViewResolver() {
|
|
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
|
|
resolver.setPrefix("WEB-INF/views/");
|
|
resolver.setSuffix(".jsp");
|
|
resolver.setViewClass(JstlView.class);
|
|
return resolver;
|
|
}
|
|
|
|
|
|
}
|
|
|