package com.mzl.flower;
|
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.core.env.Environment;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
|
|
import java.net.InetAddress;
|
import java.net.UnknownHostException;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
@Slf4j
|
@SpringBootApplication(scanBasePackages = {"com.mzl.flower"})
|
@EnableGlobalMethodSecurity(prePostEnabled = true)
|
@EnableAsync
|
@EnableScheduling
|
public class FlowerApplication {
|
|
public static void main(String[] args) throws UnknownHostException {
|
SpringApplication app = new SpringApplication(FlowerApplication.class);
|
Map<String, Object> defProperties = new HashMap();
|
defProperties.put("spring.profiles.default", "local");
|
app.setDefaultProperties(defProperties);
|
Environment env = app.run(args).getEnvironment();
|
String protocol = "http";
|
log.info("\n----------------------------------------------------------\n\t" +
|
"Application '{}' is running! Access URLs:\n\t" +
|
"Local: \t\t{}://localhost:{}\n\t" +
|
"External: \t{}://{}:{}\n\t" +
|
"Profile(s): \t{}\n----------------------------------------------------------",
|
env.getProperty("spring.application.name"),
|
protocol,
|
env.getProperty("server.port"),
|
protocol,
|
InetAddress.getLocalHost().getHostAddress(),
|
env.getProperty("server.port"),
|
env.getActiveProfiles());
|
}
|
|
}
|