Refactors code for Introduction to Apache CXF

This commit is contained in:
Thai Nguyen 2016-07-12 08:13:43 +07:00
parent 2673f28612
commit 1c1495299f
3 changed files with 14 additions and 33 deletions

View File

@ -10,9 +10,19 @@
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
</parent> </parent>
<properties> <properties>
<skipTests>true</skipTests>
<cxf.version>3.1.6</cxf.version> <cxf.version>3.1.6</cxf.version>
</properties> </properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>com.baeldung.cxf.introduction.Server</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.apache.cxf</groupId> <groupId>org.apache.cxf</groupId>
@ -25,29 +35,4 @@
<version>${cxf.version}</version> <version>${cxf.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<profiles>
<profile>
<id>server</id>
<build>
<defaultGoal>test</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.baeldung.cxf.introduction.Server</mainClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -3,15 +3,11 @@ package com.baeldung.cxf.introduction;
import javax.xml.ws.Endpoint; import javax.xml.ws.Endpoint;
public class Server { public class Server {
private Server() { public static void main(String args[]) throws InterruptedException {
BaeldungImpl implementor = new BaeldungImpl(); BaeldungImpl implementor = new BaeldungImpl();
String address = "http://localhost:8080/baeldung"; String address = "http://localhost:8080/baeldung";
Endpoint.publish(address, implementor); Endpoint.publish(address, implementor);
} System.out.println("Server ready...");
public static void main(String args[]) throws InterruptedException {
new Server();
System.out.println("Server ready");
Thread.sleep(60 * 1000); Thread.sleep(60 * 1000);
System.out.println("Server exiting"); System.out.println("Server exiting");
System.exit(0); System.exit(0);

View File

@ -21,7 +21,7 @@ public class StudentTest {
private Service service; private Service service;
private Baeldung baeldungProxy; private Baeldung baeldungProxy;
private Baeldung baeldungImpl; private BaeldungImpl baeldungImpl;
{ {
service = Service.create(SERVICE_NAME); service = Service.create(SERVICE_NAME);