All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.webdevice.wiring.WebDeviceRuntime Maven / Gradle / Ivy

There is a newer version: 0.0.11
Show newest version
package io.webdevice.wiring;

import io.webdevice.device.DeviceRegistry;
import io.webdevice.device.WebDevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;

import static io.cucumber.spring.CucumberTestContext.SCOPE_CUCUMBER_GLUE;

@Configuration
@Import(DeviceRegistrar.class)
@ComponentScan({"io.webdevice.support", "io.webdevice.wiring"})
@EnableConfigurationProperties(Settings.class)
public class WebDeviceRuntime {
    private final Settings settings;

    @Autowired
    public WebDeviceRuntime(Settings settings) {
        this.settings = settings;
    }

    @Bean
    @Primary
    @Scope(SCOPE_CUCUMBER_GLUE)
    public WebDevice webDevice(DeviceRegistry registry) {
        return new WebDevice(registry)
                .withBaseUrl(settings.getBaseUrl())
                .withDefaultDevice(settings.getDefaultDevice())
                .withEager(settings.isEager())
                .withStrict(settings.isStrict());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy