| | |
| | | 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"); |
| | |
| | | builder.append("** ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **\n"); |
| | | 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"))); |
| | | } |
| | | } |