Here are the examples of the java api @org.springframework.boot.SpringBootConfiguration taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
145 Examples
19
Source : SampleServletApplication.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced SampleServletApplication extends SpringBootServletInitializer {
@SuppressWarnings("serial")
@Bean
public Servlet dispatcherServlet() {
return new GenericServlet() {
@Override
public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
res.setContentType("text/plain");
res.getWriter().append("Hello World");
}
};
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SampleServletApplication.clreplaced);
}
public static void main(String[] args) {
SpringApplication.run(SampleServletApplication.clreplaced, args);
}
}
19
Source : SampleAtmosphereApplication.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced SampleAtmosphereApplication {
@Bean
public EmbeddedAtmosphereInitializer atmosphereInitializer() {
return new EmbeddedAtmosphereInitializer();
}
@Bean
public ServletRegistrationBean<AtmosphereServlet> atmosphereServlet() {
// Dispatcher servlet is mapped to '/home' to allow the AtmosphereServlet
// to be mapped to '/chat'
AtmosphereServlet atmosphereServlet = new AtmosphereServlet();
atmosphereServlet.framework().setHandlersPath("/");
ServletRegistrationBean<AtmosphereServlet> registration = new ServletRegistrationBean<>(atmosphereServlet, "/chat/*");
registration.addInitParameter("org.atmosphere.cpr.packages", "sample");
registration.addInitParameter("org.atmosphere.interceptor.HeartbeatInterceptor" + ".clientHeartbeatFrequencyInSeconds", "10");
registration.setLoadOnStartup(0);
// Need to occur before the EmbeddedAtmosphereInitializer
registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
return registration;
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleAtmosphereApplication.clreplaced, args);
}
@Configuration
static clreplaced MvcConfiguration implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("forward:/home/home.html");
}
}
private static clreplaced EmbeddedAtmosphereInitializer extends ContainerInitializer implements ServletContextInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
onStartup(Collections.emptySet(), servletContext);
}
}
}
19
Source : OverrideAutoConfigurationSpringBootApplication.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
/**
* Example {@link SpringBootApplication @SpringBootApplication} for use with
* {@link OverrideAutoConfiguration} tests.
*
* @author Andy Wilkinson
*/
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced OverrideAutoConfigurationSpringBootApplication {
}
19
Source : ExampleSpringBootApplication.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
/**
* Example {@link SpringBootApplication @SpringBootApplication} for use with
* {@link OverrideAutoConfiguration} tests.
*
* @author Phillip Webb
*/
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced ExampleSpringBootApplication {
}
19
Source : SubExampleConfig.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
/**
* Example config used in {@link AnnotatedClreplacedFinderTests}. Should not be found since
* scanner should only search upwards.
*
* @author Phillip Webb
*/
@SpringBootConfiguration
public clreplaced SubExampleConfig {
}
19
Source : ExampleConfig.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
/**
* Example config used in {@link AnnotatedClreplacedFinderTests}.
*
* @author Phillip Webb
*/
@SpringBootConfiguration
public clreplaced ExampleConfig {
}
19
Source : SpringBootTestContextBootstrapperExampleConfig.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
/**
* Example configuration used in
* {@link SpringBootTestContextBootstrapperIntegrationTests}.
*
* @author Phillip Webb
*/
@SpringBootConfiguration
public clreplaced SpringBootTestContextBootstrapperExampleConfig {
}
19
Source : Swagger2Configuration.java
with Apache License 2.0
from xfyun
with Apache License 2.0
from xfyun
/**
* Swagger2配置中心
*
* @author jianchen15
*/
@SpringBootConfiguration
public clreplaced Swagger2Configuration {
@Bean
public Docket createRestApi() {
Predicate<RequestHandler> predicate = new Predicate<RequestHandler>() {
@Override
public boolean apply(RequestHandler input) {
if (// 只有添加了ApiOperation注解的method才在API中显示
input.isAnnotatedWith(ApiOperation.clreplaced))
return true;
return false;
}
};
return //
new Docket(DoreplacedentationType.SWAGGER_2).apiInfo(apiInfo()).select().apis(//
predicate).paths(PathSelectors.any()).build();
}
private ApiInfo apiInfo() {
return //
new ApiInfoBuilder().replacedle("配置中心接口").description(//
"配置中心接口文档").version("1.0.0").build();
}
}
19
Source : SampleSPA.java
with Apache License 2.0
from webauthn4j
with Apache License 2.0
from webauthn4j
/**
* SampleWebApplication
*/
@Import({ AppConfig.clreplaced, DomainConfig.clreplaced, InfrastructureConfig.clreplaced })
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced SampleSPA {
public static void main(String[] args) {
SpringApplication.run(SampleSPA.clreplaced, args);
}
}
19
Source : SampleMPA.java
with Apache License 2.0
from webauthn4j
with Apache License 2.0
from webauthn4j
@Import(AppConfig.clreplaced)
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced SampleMPA {
public static void main(String[] args) {
SpringApplication.run(SampleMPA.clreplaced, args);
}
}
19
Source : SampleWebApplication.java
with Apache License 2.0
from webauthn4j
with Apache License 2.0
from webauthn4j
/**
* SampleWebApplication
*/
@Import({ AppConfig.clreplaced })
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced SampleWebApplication {
public static void main(String[] args) {
SpringApplication.run(SampleWebApplication.clreplaced, args);
}
}
19
Source : SpringMvcConfig.java
with MIT License
from watchdog-framework
with MIT License
from watchdog-framework
/**
* @author licoy.cn
* @version 2018/9/13
*/
@SpringBootConfiguration
public clreplaced SpringMvcConfig extends WebMvcConfigurerAdapter {
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
argumentResolvers.add(new JwtTokenArgumentResolver());
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ BarConfiguration.clreplaced, RunnerConfiguration.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.setLogStartupInfo(false);
app.run(args);
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ SampleConfiguration.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.run(args);
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ SampleConfiguration.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.setLogStartupInfo(false);
app.run(args);
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ SampleConfiguration.clreplaced, Foo.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.run(args);
}
@Configuration
@Import(FooCommandLineRunner.clreplaced)
protected static clreplaced FooCommandConfiguration {
}
protected static clreplaced FooCommandLineRunner implements CommandLineRunner {
private Bar bar;
@Value("${app.value}")
private String message;
public FooCommandLineRunner(Bar bar) {
this.bar = bar;
}
public void run(String... args) throws Exception {
System.out.println("Message: " + message);
System.out.println("Bar: " + bar);
System.out.println("Foo: " + bar.getFoo());
}
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced, SampleRegistrar.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.run(args);
}
@Configuration
protected static clreplaced SampleConfiguration {
@Value("${app.value}")
private String message;
@Bean
public Foo foo() {
return new Foo();
}
@Bean
public Bar bar(Foo foo) {
return new Bar(foo);
}
}
protected static clreplaced SampleRegistrar implements ImportBeanDefinitionRegistrar {
@Override
public void registerBeanDefinitions(AnnotationMetadata importingClreplacedMetadata, BeanDefinitionRegistry registry) {
registry.registerBeanDefinition("internalBarConfiguration", BeanDefinitionBuilder.genericBeanDefinition(BarPostProcessor.clreplaced).getBeanDefinition());
}
private static clreplaced BarPostProcessor implements BeanDefinitionRegistryPostProcessor {
private ConfigurableListableBeanFactory context;
public CommandLineRunner runner(Bar bar) {
return args -> {
System.out.println("Bar: " + bar);
System.out.println("Foo: " + bar.getFoo());
};
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory context) throws BeansException {
this.context = context;
}
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
registry.registerBeanDefinition("runner", BeanDefinitionBuilder.genericBeanDefinition(CommandLineRunner.clreplaced, () -> runner(context.getBean(Bar.clreplaced))).getBeanDefinition());
}
}
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
// TODO Don't depend on modules that don't exist when we are compiled - will need two
// separate projects if wanting to truly split library vs in-project dependencies
@Import({ BarConfiguration.clreplaced, RunnerConfiguration.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.setLogStartupInfo(false);
app.run(args);
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ SomeConfiguration.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced })
public clreplaced SampleApplication {
@Autowired
Bar bar;
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.setLogStartupInfo(false);
app.run(args);
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ SomeConfiguration.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.setLogStartupInfo(false);
app.run(args);
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ SampleConfiguration.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.setLogStartupInfo(false);
app.run(args);
}
@Bean
CommandLineRunner clr(Foo f) {
return args -> {
System.out.println("Foo: " + f);
System.out.println("Foo value: " + f.getValue());
};
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ FooConfiguration.clreplaced, BarConfiguration.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.setDefaultProperties(Collections.singletonMap("spring.functional.enabled", "false"));
app.setLogStartupInfo(false);
app.run(args);
}
}
19
Source : ManualApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ ActuatorConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, ReactiveWebServerFactoryAutoConfiguration.clreplaced, WebFluxAutoConfiguration.clreplaced, ErrorWebFluxAutoConfiguration.clreplaced, HttpHandlerAutoConfiguration.clreplaced })
public clreplaced ManualApplication {
public static void main(String[] args) {
SpringApplication.run(ManualApplication.clreplaced, args);
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
public clreplaced SampleApplication extends SampleConfiguration {
@Bean
@Override
public Bar bar(Foo foo) {
return new Bar(new Foo("_" + foo.getValue()));
}
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.run(args);
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced, ServletWebServerFactoryAutoConfiguration.BeanPostProcessorsRegistrar.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.run(args);
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
public clreplaced SampleApplication {
@Bean(name = "barBean")
public Bar bar(Foo foo) {
return new Bar(foo);
}
@Bean(name = "fooBean")
public Foo bar() {
return new Foo("foo");
}
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.run(args);
}
}
19
Source : SampleApplication.java
with Apache License 2.0
from spring-projects-experimental
with Apache License 2.0
from spring-projects-experimental
@SpringBootConfiguration
@Import({ SampleConfiguration.clreplaced, Foo.clreplaced, ConfigurationPropertiesAutoConfiguration.clreplaced, PropertyPlaceholderAutoConfiguration.clreplaced })
public clreplaced SampleApplication {
public static void main(String[] args) {
SpringApplication app = new SpringApplication(SampleApplication.clreplaced);
app.run(args);
}
}
19
Source : GatewayTestApplication.java
with Apache License 2.0
from spring-cloud
with Apache License 2.0
from spring-cloud
@SpringBootConfiguration
@EnableAutoConfiguration
@Import(PermitAllSecurityConfiguration.clreplaced)
public clreplaced GatewayTestApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayTestApplication.clreplaced, args);
}
/*
* TO test run `spring cloud configserver eureka`, then run this app with
* `--spring.profiles.active=discovery` should be able to hit
* http://localhost:8008/configserver/foo/default a normal configserver api
*/
@Configuration(proxyBeanMethods = false)
@EnableDiscoveryClient
@Profile("discovery")
protected static clreplaced GatewayDiscoveryConfiguration {
@Bean
public DiscoveryClientRouteDefinitionLocator discoveryClientRouteLocator(ReactiveDiscoveryClient discoveryClient, DiscoveryLocatorProperties properties) {
return new DiscoveryClientRouteDefinitionLocator(discoveryClient, properties);
}
}
}
19
Source : BaseTest.java
with Apache License 2.0
from sofastack
with Apache License 2.0
from sofastack
/**
* @author shangyu.wh
* @version $Id: BaseTest.java, v 0.1 2017-12-14 21:47 shangyu.wh Exp $
*/
@SpringBootConfiguration
public clreplaced BaseTest {
}
19
Source : PingPongApp.java
with Apache License 2.0
from rsocket-routing
with Apache License 2.0
from rsocket-routing
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced PingPongApp {
@Bean
@ConditionalOnProperty(name = "ping.one.enabled", matchIfMissing = true)
public Ping ping1() {
return new Ping(1L);
}
@Bean
@ConditionalOnProperty("ping.two.enabled")
public Ping ping2() {
return new Ping(2L);
}
@Bean
@ConditionalOnProperty(name = "pong.enabled", matchIfMissing = true)
public Pong pong() {
return new Pong();
}
/*@Bean
public ClusterClient clusterClient() {
return new ClusterClient();
}*/
public static void main(String[] args) {
Hooks.onOperatorDebug();
SpringApplication.run(PingPongApp.clreplaced, args);
}
static String reply(String in) {
if (in.length() > 4) {
in = in.substring(0, 4);
}
switch(in.toLowerCase()) {
case "ping":
return "pong";
case "pong":
return "ping";
default:
throw new IllegalArgumentException("Value must be ping or pong, not " + in);
}
}
private static void startDaemonThread(String name, MonoProcessor<Void> onClose) {
Thread awaitThread = new Thread(name + "-thread") {
@Override
public void run() {
onClose.block();
}
};
awaitThread.setContextClreplacedLoader(PingPongApp.clreplaced.getClreplacedLoader());
awaitThread.setDaemon(false);
awaitThread.start();
}
public static clreplaced Ping implements Ordered, ApplicationListener<ApplicationReadyEvent> {
private Logger logger = LoggerFactory.getLogger(getClreplaced());
private final Id id;
private final AtomicInteger pongsReceived = new AtomicInteger();
public Ping(Long id) {
this.id = new Id(0, id);
}
@Override
public int getOrder() {
return 0;
}
public void onApplicationEventx(ApplicationReadyEvent event) {
logger.info("Skipping Ping {}", id);
}
public void onApplicationEvent(ApplicationReadyEvent event) {
logger.info("Starting Ping {}", id);
ConfigurableEnvironment env = event.getApplicationContext().getEnvironment();
Integer take = env.getProperty("ping.take", Integer.clreplaced, null);
Integer port = env.getProperty("ping.broker.port", Integer.clreplaced, 8001);
logger.debug("ping.take: {}", take);
RoutingRSocketClient client = RoutingRSocketConnector.create().routeId(id).serviceName("ping").toRSocketClient(TcpClientTransport.create(port));
Flux<? extends String> pongFlux = Flux.from(doPing(take, client));
boolean subscribe = env.getProperty("ping.subscribe", Boolean.clreplaced, true);
if (subscribe) {
pongFlux.subscribe();
}
MonoProcessor<Void> onClose = MonoProcessor.create();
startDaemonThread("ping" + id, onClose);
}
// Publisher<? extends String> doPing(Integer take, RSocket socket) {
Publisher<? extends String> doPing(Integer take, RoutingRSocketClient client) {
Flux<String> pong = client.requestChannel(Flux.interval(Duration.ofSeconds(1)).map(i -> {
ByteBuf data = ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, "ping" + id);
CompositeByteBuf compositeMetadata = client.allocator().compositeBuffer();
// client.encodeAddressMetadata(compositeMetadata, "pong");
client.encodeAddressMetadata(compositeMetadata, tags -> tags.with(WellKnownKey.SERVICE_NAME, "pong"));
logger.debug("Sending ping" + id);
return DefaultPayload.create(data, compositeMetadata);
// onBackpressure is needed in case pong is not available yet
}).log("doPing").onBackpressureDrop(payload -> logger.debug("Dropped payload {}", payload.getDataUtf8()))).map(Payload::getDataUtf8).doOnNext(str -> {
int received = pongsReceived.incrementAndGet();
logger.info("received {}({}) in Ping {}", str, received, id);
}).doFinally(signal -> client.dispose());
if (take != null) {
return pong.take(take);
}
return pong;
}
}
public static clreplaced Pong implements Ordered, ApplicationListener<ApplicationReadyEvent> {
private final Id routeId = new Id(0, 3L);
private Logger logger = LoggerFactory.getLogger(getClreplaced());
private final AtomicInteger pingsReceived = new AtomicInteger();
private RoutingRSocketClient rSocketClient;
@Override
public int getOrder() {
return 1;
}
public void onApplicationEventx(ApplicationReadyEvent event) {
logger.info("Skipping Pong");
}
public void onApplicationEvent(ApplicationReadyEvent event) {
ConfigurableEnvironment env = event.getApplicationContext().getEnvironment();
Integer pongDelay = env.getProperty("pong.delay", Integer.clreplaced, 5000);
try {
Thread.sleep(pongDelay);
} catch (InterruptedException e) {
e.printStackTrace();
}
logger.info("Starting Pong");
Integer port = env.getProperty("pong.broker.port", Integer.clreplaced, 8001);
// MicrometerRSocketInterceptor interceptor = new MicrometerRSocketInterceptor(
// meterRegistry, Tag.of("component", "pong"));
rSocketClient = RoutingRSocketConnector.create().routeId(routeId).serviceName("pong").configure(connector -> {
/*.addRequesterPlugin(interceptor)*/
connector.acceptor((setup, sendingSocket) -> Mono.just(accept(sendingSocket)));
}).toRSocketClient(TcpClientTransport.create(port));
// proxy
rSocketClient.source().block();
MonoProcessor<Void> onClose = MonoProcessor.create();
startDaemonThread("pong", onClose);
}
@SuppressWarnings("Duplicates")
RSocket accept(RSocket rSocket) {
return new RSocketProxy(rSocket) {
@Override
public Flux<Payload> requestChannel(Publisher<Payload> payloads) {
return Flux.from(payloads).map(Payload::getDataUtf8).doOnNext(str -> {
int received = pingsReceived.incrementAndGet();
logger.info("received {}({}) in Pong", str, received);
}).map(PingPongApp::reply).map(reply -> {
ByteBuf data = ByteBufUtil.writeUtf8(ByteBufAllocator.DEFAULT, reply);
CompositeByteBuf routingMetadata = rSocketClient.allocator().compositeBuffer();
rSocketClient.encodeAddressMetadata(routingMetadata, "ping");
return DefaultPayload.create(data, routingMetadata);
});
}
};
}
}
}
19
Source : Broker2App.java
with Apache License 2.0
from rsocket-routing
with Apache License 2.0
from rsocket-routing
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced Broker2App {
public static void main(String[] args) {
new SpringApplicationBuilder(Broker2App.clreplaced).properties("spring.config.name=broker2").run(args);
}
}
19
Source : Broker1App.java
with Apache License 2.0
from rsocket-routing
with Apache License 2.0
from rsocket-routing
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced Broker1App {
public static void main(String[] args) {
new SpringApplicationBuilder(Broker1App.clreplaced).properties("spring.config.name=broker1").run(args);
}
}
19
Source : SpringBootApplication.java
with Apache License 2.0
from OpenAPITools
with Apache License 2.0
from OpenAPITools
@ImportResource({ "clreplacedpath:/ApplicationContext.xml" })
@EnableAutoConfiguration
@SpringBootConfiguration
public clreplaced SpringBootApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(SpringBootApplication.clreplaced);
}
public static void main(String[] args) {
SpringApplication.run(SpringBootApplication.clreplaced, args);
}
}
19
Source : KogitoObjectMapperSpringTemplate.java
with Apache License 2.0
from kiegroup
with Apache License 2.0
from kiegroup
@SpringBootConfiguration
public clreplaced KogitoObjectMapper {
@Bean
public Jackson2ObjectMapperBuilderCustomizer customizeObjectMapper() {
return new Jackson2ObjectMapperBuilderCustomizer() {
@Override
public void customize(Jackson2ObjectMapperBuilder builder) {
// addDefaultDeserializers
builder.deserializerByType(DataStream.clreplaced, new DataStreamDeserializer());
builder.deserializerByType(DataStore.clreplaced, new DataStoreDeserializer());
builder.deserializerByType(SingletonStore.clreplaced, new SingletonStoreDeserializer());
}
};
}
public static clreplaced DataStreamDeserializer extends JsonDeserializer<DataStream<?>> implements ContextualDeserializer {
private CollectionType collectionType;
@Override
public DataStream deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
DataStream stream = DataSource.createStream();
List list = ctxt.readValue(jp, collectionType);
list.forEach(stream::append);
return stream;
}
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException {
CollectionType collectionType = ctxt.getTypeFactory().constructCollectionType(List.clreplaced, property.getType().containedType(0));
DataStreamDeserializer deserializer = new DataStreamDeserializer();
deserializer.collectionType = collectionType;
return deserializer;
}
}
public static clreplaced DataStoreDeserializer extends JsonDeserializer<DataStore<?>> implements ContextualDeserializer {
private CollectionType collectionType;
@Override
public DataStore deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
DataStore store = DataSource.createStore();
List list = ctxt.readValue(jp, collectionType);
list.forEach(store::add);
return store;
}
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException {
CollectionType collectionType = ctxt.getTypeFactory().constructCollectionType(List.clreplaced, property.getType().containedType(0));
DataStoreDeserializer deserializer = new DataStoreDeserializer();
deserializer.collectionType = collectionType;
return deserializer;
}
}
public static clreplaced SingletonStoreDeserializer extends JsonDeserializer<SingletonStore<?>> implements ContextualDeserializer {
private JavaType javaType;
@Override
public SingletonStore deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
SingletonStore store = DataSource.createSingleton();
store.set(ctxt.readValue(jp, javaType));
return store;
}
@Override
public JsonDeserializer<?> createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException {
JavaType javaType = property.getType().containedType(0);
SingletonStoreDeserializer deserializer = new SingletonStoreDeserializer();
deserializer.javaType = javaType;
return deserializer;
}
}
}
19
Source : ControllerTestConfiguration.java
with Apache License 2.0
from hyscale
with Apache License 2.0
from hyscale
@SpringBootConfiguration
@ComponentScan(basePackages = "io.hyscale", excludeFilters = @Filter(type = FilterType.replacedIGNABLE_TYPE, clreplacedes = CommandLineRunner.clreplaced))
@EnableAutoConfiguration
public clreplaced ControllerTestConfiguration {
private static final String TEST_DOCKER_CONFIG = "/config/registry.json";
@MockBean
public ControllerConfig controllerConfig;
@PostConstruct
public void init() {
Mockito.when(controllerConfig.getDefaultKubeConf()).thenReturn(null);
URL resourceAsUrl = ControllerTestConfiguration.clreplaced.getResource(TEST_DOCKER_CONFIG);
Mockito.when(controllerConfig.getDefaultRegistryConf()).thenReturn(resourceAsUrl.getPath());
}
}
19
Source : SampleAtmosphereApplication.java
with Apache License 2.0
from hello-shf
with Apache License 2.0
from hello-shf
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced SampleAtmosphereApplication {
@Bean
public EmbeddedAtmosphereInitializer atmosphereInitializer() {
return new EmbeddedAtmosphereInitializer();
}
@Bean
public ServletRegistrationBean<AtmosphereServlet> atmosphereServlet() {
// Dispatcher servlet is mapped to '/home' to allow the AtmosphereServlet
// to be mapped to '/chat'
ServletRegistrationBean<AtmosphereServlet> registration = new ServletRegistrationBean<>(new AtmosphereServlet(), "/chat/*");
registration.addInitParameter("org.atmosphere.cpr.packages", "sample");
registration.addInitParameter("org.atmosphere.interceptor.HeartbeatInterceptor" + ".clientHeartbeatFrequencyInSeconds", "10");
registration.setLoadOnStartup(0);
// Need to occur before the EmbeddedAtmosphereInitializer
registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
return registration;
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleAtmosphereApplication.clreplaced, args);
}
@Configuration
static clreplaced MvcConfiguration implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("forward:/home/home.html");
}
}
private static clreplaced EmbeddedAtmosphereInitializer extends ContainerInitializer implements ServletContextInitializer {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
onStartup(Collections.emptySet(), servletContext);
}
}
}
19
Source : RabbitMQConfig.java
with GNU General Public License v3.0
from guang19
with GNU General Public License v3.0
from guang19
/**
* @Author yangguang
* @Date 2020/1/26
* @Description TODO
*/
@SpringBootConfiguration
public clreplaced RabbitMQConfig {
@Bean
public RabbitAdmin rabbitAdmin(@Qualifier("tRabbitTemplate") RabbitTemplate rabbitTemplate) {
RabbitAdmin rabbitAdmin = new RabbitAdmin(rabbitTemplate);
rabbitAdmin.setAutoStartup(true);
return rabbitAdmin;
}
@Bean("tRabbitTemplate")
public RabbitTemplate rabbitTemplate(@Qualifier("rabbitConnectionFactory") ConnectionFactory connectionFactory) {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
RabbitTemplate.ConfirmCallback confirmCallback = (correlationData, ack, cause) -> {
System.out.println("correlation : " + correlationData);
if (!ack) {
System.err.println(cause);
}
};
RabbitTemplate.ReturnCallback returnCallback = (message, replyCode, replyText, exchange, routingKey) -> {
System.out.println(message);
System.out.println(replyCode);
System.out.println(replyText);
System.out.println(exchange);
System.out.println(routingKey);
};
rabbitTemplate.setConfirmCallback(confirmCallback);
rabbitTemplate.setReturnCallback(returnCallback);
return rabbitTemplate;
}
}
19
Source : DemoApplication.java
with Apache License 2.0
from flowable
with Apache License 2.0
from flowable
/**
* Build and run with
* java -noverify -jar flowable-function-spring-boot-sample-6.4.0-SNAPSHOT.jar
*
* Try with
* curl localhost:8084 -d test
*/
@SpringBootConfiguration
public clreplaced DemoApplication implements Function<String, String> {
public static ProcessEngine processEngine = ServerlessUtil.initializeProcessEngineForBpmnModel(commandContext -> SimpleServiceTask.createSimpleServiceTaskBpmnModel());
public static void main(String[] args) {
FunctionalSpringApplication.run(DemoApplication.clreplaced, args);
}
@Override
public String apply(String value) {
String processInstanceId = processEngine.getRuntimeService().startProcessInstanceById(ServerlessUtil.PROCESS_DEFINITION_ID).getId();
return "[Spring Cloud] - new process instance " + processInstanceId + " started. Number of delegation executions = " + MyJavaDelegate.COUNTER.get();
}
}
19
Source : SpringCloudFunctionalApplication.java
with Apache License 2.0
from fangjian0423
with Apache License 2.0
from fangjian0423
/**
* @author <a href="mailto:[email protected]">Jim</a>
*/
@SpringBootConfiguration
public clreplaced SpringCloudFunctionalApplication implements ApplicationContextInitializer<GenericApplicationContext> {
public static void main(String[] args) {
FunctionalSpringApplication.run(SpringCloudFunctionalApplication.clreplaced, args);
}
public Function<String, String> upperCase() {
return value -> value.toUpperCase();
}
@Override
public void initialize(GenericApplicationContext context) {
context.registerBean("demo", FunctionRegistration.clreplaced, () -> new FunctionRegistration<>(upperCase()).type(FunctionType.from(String.clreplaced).to(String.clreplaced)));
}
}
19
Source : TransferConfiguration.java
with Apache License 2.0
from epam
with Apache License 2.0
from epam
@SpringBootConfiguration
@EnreplacedyScan(basePackages = { "com.epam.pipeline.dts.transfer.model" })
@EnableJpaRepositories(basePackages = { "com.epam.pipeline.dts.transfer.repository" })
@ComponentScan(excludeFilters = { @ComponentScan.Filter(type = FilterType.replacedIGNABLE_TYPE, value = TransferRestConfiguration.clreplaced), @ComponentScan.Filter(type = FilterType.ANNOTATION, value = Controller.clreplaced) })
public clreplaced TransferConfiguration {
@Bean
public DataUploaderProvider dataUploaderProvider(final List<DataUploader> providers) {
final Map<StorageType, DataUploader> dataUploaders = CollectionUtils.isEmpty(providers) ? new EnumMap<>(StorageType.clreplaced) : providers.stream().collect(Collectors.toMap(DataUploader::getStorageType, Function.idenreplacedy()));
return new DataUploaderProviderImpl(dataUploaders);
}
@Bean
public PipelineCliProvider pipelineCliProvider(final CmdExecutorsProvider cmdExecutorsProvider, @Value("${dts.transfer.pipe.executable}") final String pipelineCliExecutable, @Value("${dts.transfer.pipe.cp.suffix:}") final String pipeCpSuffix, @Value("${dts.transfer.grid.template}") final String qsubTemplate, @Value("${dts.transfer.grid.upload}") final boolean isGridUploadEnabled, @Value("${dts.transfer.upload.force}") final boolean forceUpload, @Value("${dts.transfer.upload.retry}") final int retryCount) {
return new PipelineCliProviderImpl(cmdExecutorsProvider, pipelineCliExecutable, pipeCpSuffix, qsubTemplate, isGridUploadEnabled, forceUpload, retryCount);
}
@Bean
public CmdExecutorsProvider cmdExecutorsProvider() {
return new CmdExecutorsProviderImpl();
}
@Bean
public DataUploader s3DataUploader(final PipelineCliProvider pipelineCliProvider) {
return new S3DataUploader(pipelineCliProvider);
}
@Bean
public DataUploader azureDataUploader(final PipelineCliProvider pipelineCliProvider) {
return new AzureDataUploader(pipelineCliProvider);
}
@Bean
public DataUploader gsDataUploader(final PipelineCliProvider pipelineCliProvider) {
return new GSDataUploader(pipelineCliProvider);
}
}
19
Source : ListingConfiguration.java
with Apache License 2.0
from epam
with Apache License 2.0
from epam
@SpringBootConfiguration
@ComponentScan(excludeFilters = { @ComponentScan.Filter(type = FilterType.replacedIGNABLE_TYPE, value = ListingRestConfiguration.clreplaced), @ComponentScan.Filter(type = FilterType.ANNOTATION, value = Controller.clreplaced) })
public clreplaced ListingConfiguration {
@Bean
public JsonMapper jsonMapper() {
return new JsonMapper();
}
@Bean
public CmdExecutor listingCmdExecutor() {
return new ImpersonatingCmdExecutor(new PlainCmdExecutor());
}
}
19
Source : ControllersTestConfig.java
with Eclipse Public License 1.0
from ControlSystemStudio
with Eclipse Public License 1.0
from ControlSystemStudio
@SpringBootConfiguration
@ComponentScan(basePackages = "org.phoebus.service.saveandrestore.web.controllers")
public clreplaced ControllersTestConfig {
@Bean
public IServices services() {
return Mockito.mock(IServices.clreplaced);
}
}
19
Source : MvcConfiguration.java
with GNU General Public License v2.0
from CipherChina
with GNU General Public License v2.0
from CipherChina
/**
* @Author: zt
* 不拦截默认的静态资源
* 添加登录拦截器
* @Date: 2018/5/28 21:30
*/
// @Configuration
@SpringBootConfiguration
public clreplaced MvcConfiguration extends WebMvcConfigurerAdapter {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/static/**").addResourceLocations("clreplacedpath:/static/");
super.addResourceHandlers(registry);
}
@Bean
public LoginInterCeptor loginInterCeptor() {
return new LoginInterCeptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
// registry.addInterceptor(loginInterCeptor());
}
}
19
Source : CustomErrorViewResolverExample.java
with Apache License 2.0
from chanjarster
with Apache License 2.0
from chanjarster
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan(basePackages = { "me.chanjar.boot.customerrorviewresolver", "me.chanjar.controllers" }, excludeFilters = { @ComponentScan.Filter(type = FilterType.CUSTOM, clreplacedes = TypeExcludeFilter.clreplaced), @ComponentScan.Filter(type = FilterType.CUSTOM, clreplacedes = AutoConfigurationExcludeFilter.clreplaced), // 这里要排除自动扫描时扫到CustomErrorController
@ComponentScan.Filter(type = FilterType.replacedIGNABLE_TYPE, clreplacedes = CustomErrorController.clreplaced) })
public clreplaced CustomErrorViewResolverExample {
public static void main(String[] args) {
SpringApplication.run(CustomErrorViewResolverExample.clreplaced, args);
}
}
19
Source : BeanConfiguration.java
with Apache License 2.0
from aws
with Apache License 2.0
from aws
/**
* Contains all Spring bean configurations
*/
@SpringBootConfiguration
public clreplaced BeanConfiguration {
private static final String DEFAULT_HTTP_LISTENER_PORT = "8080";
private static final String DEFAULT_MODEL_LOCATION = "/opt/ml/model";
private static final Integer MAX_CORE_TO_THREAD_RATIO = 10;
private static final Integer MIN_CORE_TO_THREAD_RATIO = 2;
@Bean
public File provideModelFile() {
return new File(DEFAULT_MODEL_LOCATION);
}
@Bean
public ContextBuilder provideContextBuilder() {
return new ContextBuilder();
}
@Bean
public MleapContext provideMleapContext(ContextBuilder contextBuilder) {
return contextBuilder.createMleapContext();
}
@Bean
public BundleBuilder provideBundleBuilder() {
return new BundleBuilder();
}
@Bean
public LeapFrameBuilder provideLeapFrameBuilder() {
return new LeapFrameBuilder();
}
@Bean
public LeapFrameBuilderSupport provideLeapFrameBuilderSupport() {
return new LeapFrameBuilderSupport();
}
@Bean
public Transformer provideTransformer(final File modelFile, final BundleBuilder bundleBuilder, final MleapContext mleapContext) {
return bundleBuilder.load(modelFile, mleapContext).root();
}
@Bean
public ObjectMapper provideObjectMapper() {
return new ObjectMapper();
}
@Bean
public JettyServletWebServerFactory provideJettyServletWebServerFactory() {
final JettyServletWebServerFactory jettyServlet = new JettyServletWebServerFactory(new Integer(this.getHttpListenerPort()));
final List<JettyServerCustomizer> serverCustomizerList = Lists.newArrayList();
final JettyServerCustomizer serverCustomizer = server -> {
final QueuedThreadPool threadPool = server.getBean(QueuedThreadPool.clreplaced);
threadPool.setMinThreads(SystemUtils.getNumberOfThreads(MIN_CORE_TO_THREAD_RATIO));
threadPool.setMaxThreads(SystemUtils.getNumberOfThreads(MAX_CORE_TO_THREAD_RATIO));
};
serverCustomizerList.add(serverCustomizer);
jettyServlet.setServerCustomizers(serverCustomizerList);
return jettyServlet;
}
@VisibleForTesting
protected String getHttpListenerPort() {
return (SystemUtils.getEnvironmentVariable("SAGEMAKER_BIND_TO_PORT") != null) ? SystemUtils.getEnvironmentVariable("SAGEMAKER_BIND_TO_PORT") : DEFAULT_HTTP_LISTENER_PORT;
}
}
19
Source : MyWebConfigurer.java
with MIT License
from Antabot
with MIT License
from Antabot
/**
* @author Evan
* @date 2019/4
*/
@SpringBootConfiguration
public clreplaced MyWebConfigurer implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
// 所有请求都允许跨域,使用这种配置方法就不能在 interceptor 中再配置 header 了
registry.addMapping("/**").allowCredentials(true).allowedOrigins("http://localhost:8080").allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE").allowedHeaders("*").maxAge(3600);
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/api/file/**").addResourceLocations("file:" + "d:/workspace/img/");
}
}
19
Source : SupportConfig.java
with MIT License
from aiyoyoyo
with MIT License
from aiyoyoyo
@SpringBootConfiguration
@EnableTransactionManagement(proxyTargetClreplaced = true)
@DependsOn({ "commonContextHolder" })
@Log4j2
public clreplaced SupportConfig {
@Bean
public AtomikosProperties getAtomikosProperties() {
AtomikosProperties ap = new AtomikosProperties();
return ap;
}
/**
* atomikos事务管理器,一般情况无需修改
* @return 用户事务
*/
@Bean(initMethod = "init", destroyMethod = "close")
public UserTransactionManager atomikosTM() {
if (CommonConfig.getBoolean("jees.jdbs.enable") != true)
return null;
UserTransactionManager utm = new UserTransactionManager();
utm.setForceShutdown(false);
log.debug("--Spring Bean[atomikosTM]初始化.");
return utm;
}
/**
* atomikos事务实现,一般情况无需修改
* @return 用户事物实现类
* @throws SystemException 系统异常
*/
@Bean
public UserTransactionImp atomikosUT() throws SystemException {
UserTransactionImp uti = new UserTransactionImp();
if (CommonConfig.getBoolean("jees.jdbs.enable") != true)
return uti;
uti.setTransactionTimeout(CommonConfig.getInteger("jees.jdbs.trans.timeout", 300));
log.debug("--Spring Bean[atomikosUT]初始化.");
return uti;
}
/**
* spring jta 事务管理器,一般情况无需修改
* @param _utm 用户事务管理器
* @param _uti 用户事务实现
* @return jta事务管理器
*/
@Bean
public JtaTransactionManager transactionManager(@Qualifier("atomikosTM") UserTransactionManager _utm, @Qualifier("atomikosUT") UserTransactionImp _uti) {
JtaTransactionManager jtm = new JtaTransactionManager();
jtm.setTransactionManager(_utm);
jtm.setUserTransaction(_uti);
jtm.setAllowCustomIsolationLevels(CommonConfig.getBoolean("jees.jdbs.trans.allowCustomIsolationLevels", false));
log.debug("--Spring Bean[defaultTM]初始化.");
return jtm;
}
@Bean
public AtomikosJtaPlatform atomikosJP(@Qualifier("transactionManager") JtaTransactionManager _jtm) {
if (CommonConfig.getBoolean("jees.jdbs.enable") != true)
return null;
log.debug("--Spring Bean[atomikosJP]初始化.");
return new AtomikosJtaPlatform(_jtm);
}
/**
* 找到声明的数据库配置清单依次注入,并返回默认数据库
* @return SessionFactory
*/
@Bean
@DependsOn("atomikosJP")
public SessionFactory sessionFactory() {
if (CommonConfig.getBoolean("jees.jdbs.enable") != true)
return null;
SessionFactoryRegistry sfr = new SessionFactoryRegistry();
StringTokenizer st = CommonConfig.getStringTokenizer("jees.jdbs.dbNames");
while (st.hasMoreTokens()) {
String d = st.nextToken();
sfr.registerSessionFactory(d.trim());
}
return CommonContextHolder.getBean(CommonConfig.getString("jees.jdbs.defaultDB", "default") + "SessionFactory");
}
}
19
Source : SimpleMessageStoreTests.java
with Apache License 2.0
from Activiti
with Apache License 2.0
from Activiti
@SpringBootConfiguration
@EnableAutoConfiguration
public clreplaced SimpleMessageStoreTests extends AbstractMessagesCoreIntegrationTests {
@Test
public void testMessageStore() throws Exception {
replacedertThat(this.aggregatingMessageHandler.getMessageStore()).isInstanceOf(SimpleMessageStore.clreplaced);
}
}
19
Source : FileUpLoadConfig.java
with zlib License
from 981011512
with zlib License
from 981011512
@SpringBootConfiguration
public clreplaced FileUpLoadConfig {
// 显示声明CommonsMultipartResolver为mutipartResolver
@Bean(name = "multipartResolver")
public MultipartResolver multipartResolver() {
CommonsMultipartResolver resolver = new CommonsMultipartResolver();
resolver.setDefaultEncoding("UTF-8");
// resolveLazily属性启用是为了推迟文件解析,以在在UploadAction中捕获文件大小异常
resolver.setResolveLazily(true);
resolver.setMaxInMemorySize(40960);
// 上传文件大小 50M 50*1024*1024
resolver.setMaxUploadSize(50 * 1024 * 1024);
return resolver;
}
}
18
Source : SampleWebClientConfiguration.java
with Apache License 2.0
from yuanmabiji
with Apache License 2.0
from yuanmabiji
/**
* A sample {@link SpringBootConfiguration} with an example controller.
*
* @author Stephane Nicoll
*/
@SpringBootConfiguration
@ImportAutoConfiguration({ ServletWebServerFactoryAutoConfiguration.clreplaced, DispatcherServletAutoConfiguration.clreplaced, JacksonAutoConfiguration.clreplaced, HttpMessageConvertersAutoConfiguration.clreplaced })
clreplaced SampleWebClientConfiguration {
@RestController
private static clreplaced ExampleController {
@RequestMapping("/example")
public ResponseEnreplacedy<String> example() {
return ResponseEnreplacedy.ok().location(URI.create("https://other.example.com/example")).body("test");
}
}
}
See More Examples