linzhijie
2021-03-11 93af1c6ffb9ae0e894689ad3a37b548e57d54cff
src/main/java/com/ots/OtsApplication.java
@@ -1,30 +1,18 @@
package com.ots;
import com.ulisesbocchio.jasyptspringboot.annotation.EnableEncryptableProperties;
import org.jasypt.encryption.StringEncryptor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;
/**
 * 启动程序
 *
 * @author ots
 */
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableEncryptableProperties
public class OtsApplication implements CommandLineRunner {
    private static final Logger l = LoggerFactory.getLogger(OtsApplication.class);
    @Autowired
    private StringEncryptor stringEncryptor;
    @Autowired
    private ApplicationContext applicationContext;
public class OtsApplication {
    public static void main(String[] args) {
        // System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(OtsApplication.class, args);
        StringBuilder builder = new StringBuilder();
        builder.append("********************************************************************\n");
@@ -35,10 +23,4 @@
        builder.append("********************************************************************\n");
        System.out.println(builder.toString());
    }
    @Override
    public void run(String... args) throws Exception {
        Environment environment = applicationContext.getEnvironment();
        l.info(stringEncryptor.encrypt(environment.getProperty("password")));
    }
}
}