JAVA-12579 Renamed spring-remoting to spring-remoting-modules
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.baeldung.server;
|
||||
|
||||
import com.baeldung.api.Booking;
|
||||
import com.baeldung.api.BookingException;
|
||||
import com.baeldung.api.CabBookingService;
|
||||
|
||||
import static java.lang.Math.random;
|
||||
import static java.util.UUID.randomUUID;
|
||||
|
||||
public class CabBookingServiceImpl implements CabBookingService {
|
||||
|
||||
@Override public Booking bookRide(String pickUpLocation) throws BookingException {
|
||||
if (random() < 0.3) throw new BookingException("Cab unavailable");
|
||||
return new Booking(randomUUID().toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.baeldung.server;
|
||||
|
||||
import com.baeldung.api.CabBookingService;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter;
|
||||
|
||||
@Configuration
|
||||
@ComponentScan
|
||||
@EnableAutoConfiguration
|
||||
public class Server {
|
||||
|
||||
@Bean(name = "/booking") HttpInvokerServiceExporter accountService() {
|
||||
HttpInvokerServiceExporter exporter = new HttpInvokerServiceExporter();
|
||||
exporter.setService( new CabBookingServiceImpl() );
|
||||
exporter.setServiceInterface( CabBookingService.class );
|
||||
return exporter;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Server.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.baeldung;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.baeldung.server.Server;
|
||||
|
||||
@SpringBootTest(classes = Server.class)
|
||||
@RunWith(SpringRunner.class)
|
||||
public class SpringContextTest {
|
||||
|
||||
@Test
|
||||
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user