Skip to content

Commit

Permalink
(update) spring boot 2.0.0.RELEASE
Browse files Browse the repository at this point in the history
Use the new version of spring boot.  This will change the SPI because
Spring boot now uses Class<?>[] to boostrap rather than Object[].

It also upgrades Mockito to 2.x which requires an additional test scope
library for Vert.X mock testing.
  • Loading branch information
trajano committed Mar 9, 2018
1 parent 49c6c01 commit 88da410
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class VertxMicroserviceEngine implements
* Sets the system properties and sets up the logger. {@inheritDoc}
*/
@Override
public Object[] bootstrap() {
public Class<?>[] bootstrap() {

System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory");

Expand All @@ -76,7 +76,7 @@ public Object[] bootstrap() {
System.setProperty("logging.config", logbackFile.getAbsolutePath());
}

return new Object[] {
return new Class<?>[] {
VertxConfig.class,
VertxMicroserviceEngine.class
};
Expand Down
9 changes: 2 additions & 7 deletions ms-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.enterprise</groupId>
Expand Down Expand Up @@ -121,11 +121,6 @@
<artifactId>jcl-over-slf4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
Expand All @@ -152,7 +147,7 @@
<inherited>false</inherited>
<configuration>
<rules>
<dependencyConvergence />
<dependencyConvergence/>
</rules>
</configuration>
</execution>
Expand Down
4 changes: 2 additions & 2 deletions ms-common/src/main/java/net/trajano/ms/Microservice.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public static void run(final Class<? extends Application> applicationClass,
}
Microservice.applicationClass = applicationClass;

final Object[] bootstrapObjects = microserviceEngine.bootstrap();
final Object[] sources = new Object[extraSources.length + bootstrapObjects.length];
final Class<?>[] bootstrapObjects = microserviceEngine.bootstrap();
final Class<?>[] sources = new Class<?>[extraSources.length + bootstrapObjects.length];

System.arraycopy(extraSources, 0, sources, 0, extraSources.length);
System.arraycopy(bootstrapObjects, 0, sources, extraSources.length, bootstrapObjects.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ public interface MicroserviceEngine {

/**
* Performs the initialization of the microservice engine and returns an array
* of objects that would be used to bootstrap Spring.
* of classes that would be used to bootstrap Spring.
*
* @return starting context objects.
* @return starting context classes.
*/
Object[] bootstrap();
Class<?>[] bootstrap();

/**
* Gets the host name of where the engine is running. This may be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void setEngines(final MicroserviceEngine... engines) {
public void bootstrapTest() throws Exception {

final MicroserviceEngine microserviceEngine = Mockito.mock(MicroserviceEngine.class);
Mockito.when(microserviceEngine.bootstrap()).thenReturn(new Object[] {
Mockito.when(microserviceEngine.bootstrap()).thenReturn(new Class<?>[] {
MyApp.class
});
new TestMicroservice().setEngines(microserviceEngine);
Expand All @@ -49,7 +49,7 @@ public void bootstrapTest() throws Exception {
public void doubleRunTest() throws Exception {

final MicroserviceEngine microserviceEngine = Mockito.mock(MicroserviceEngine.class);
Mockito.when(microserviceEngine.bootstrap()).thenReturn(new Object[] {
Mockito.when(microserviceEngine.bootstrap()).thenReturn(new Class<?>[] {
MyApp.class
});
new TestMicroservice().setApplicationAndEngines(MyApp.class, microserviceEngine);
Expand Down
6 changes: 6 additions & 0 deletions ms-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-codegen</artifactId>
<version>${vertx.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-unit</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions ms-gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@
<artifactId>jcl-over-slf4j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-codegen</artifactId>
<version>${vertx.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.trajano.commons</groupId>
<artifactId>commons-testing</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<linkcheck.skip>true</linkcheck.skip>
<repo.id>app-ms</repo.id>
<slf4j.version>1.7.16</slf4j.version>
<spring.boot.version>1.5.10.RELEASE</spring.boot.version>
<spring.boot.version>2.0.0.RELEASE</spring.boot.version>
<vertx.version>3.5.1</vertx.version>
</properties>
<dependencyManagement>
Expand Down

0 comments on commit 88da410

Please sign in to comment.