@Component
@ConditionalOnProperty(prefix = "jwt", name = "enable",havingValue = "true")
public class JwtUtil {

private static String header = "";
private static String username = "";
private static String password = "";

@Autowired
private Environment env;

public JwtUtil(Environment env) {
this.env = env;
}

@PostConstruct
public void config() {
url = env.getProperty("spring.datasource.url");
username = env.getProperty("spring.datasource.username");
password = env.getProperty("spring.datasource.password");
}

注意加开关