cashier-client/src/main/java/com/chaozhanggui/system/cashierservice/Shell.java

60 lines
2.1 KiB
Java

package com.chaozhanggui.system.cashierservice;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.ApplicationContext;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
@EnableScheduling
@EntityScan(basePackageClasses = {Shell.class})
@MapperScan(basePackageClasses ={Shell.class} )
@ComponentScan(basePackageClasses ={Shell.class})
@EnableAspectJAutoProxy(proxyTargetClass = true)
@Slf4j
public class Shell {
private static Logger logger = LoggerFactory.getLogger(Shell.class);
public static void main(String[] args) {
SpringApplication springApplication = new SpringApplication(Shell.class);
springApplication.run(args);
}
@Bean
public RestTemplate restTemplate(){
return new RestTemplate();
}
@Bean
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
return (args) -> {
logger.info("=========================启动完成==========================");
};
}
@Bean
public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer();
propertySourcesPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(true);
return propertySourcesPlaceholderConfigurer;
}
}