org.springframework.boot.ResourceBanner Java Examples

The following examples show how to use org.springframework.boot.ResourceBanner. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BannerListener.java    From mPaaS with Apache License 2.0 5 votes vote down vote up
@Override
public void environmentPrepared(ConfigurableEnvironment environment) {
    if(springApplication.getWebApplicationType() == WebApplicationType.NONE){
        return;
    }

    if (executed.compareAndSet(false, true)) {
        String bannerConfig = environment.getProperty(SpringApplication.BANNER_LOCATION_PROPERTY);
        if (StringUtils.isEmpty(bannerConfig)) {
            URL url = BannerListener.class.getResource(BANNER_PATH);
            springApplication.setBanner(new ResourceBanner(new UrlResource(url)));
        }
    }
}
 
Example #2
Source File: BannerListener.java    From mPass with Apache License 2.0 5 votes vote down vote up
@Override
public void environmentPrepared(ConfigurableEnvironment environment) {
    if(springApplication.getWebApplicationType() == WebApplicationType.NONE){
        return;
    }

    if (executed.compareAndSet(false, true)) {
        String bannerConfig = environment.getProperty(SpringApplication.BANNER_LOCATION_PROPERTY);
        if (StringUtils.isEmpty(bannerConfig)) {
            URL url = BannerListener.class.getResource(BANNER_PATH);
            springApplication.setBanner(new ResourceBanner(new UrlResource(url)));
        }
    }
}
 
Example #3
Source File: ShellBanner.java    From sshd-shell-spring-boot with Apache License 2.0 5 votes vote down vote up
@PostConstruct
void init() {
    ResourceLoader resourceLoader = new DefaultResourceLoader();
    String location = environment.getProperty("banner.image.location");
    if (StringUtils.hasLength(location)) {
        addBanner(resourceLoader, location, resource -> new ImageBanner(resource));
    } else {
        for (String ext : SUPPORTED_IMAGES) {
            addBanner(resourceLoader, "banner." + ext, resource -> new ImageBanner(resource));
        }
    }
    addBanner(resourceLoader, environment.getProperty("banner.location", "banner.txt"),
            resource -> new ResourceBanner(resource));
}