Skip to content

Commit

Permalink
Upgrade to Spring Boot 2.0.8 (#325)
Browse files Browse the repository at this point in the history
  • Loading branch information
raveeram committed Feb 27, 2019
1 parent db750a3 commit db3df1d
Show file tree
Hide file tree
Showing 16 changed files with 102 additions and 42 deletions.
35 changes: 20 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,9 @@ configure(javaProjects) {

dependencyManagement {
imports {
mavenBom "io.spring.platform:platform-bom:${spring_platform_version}"
mavenBom "org.springframework.boot:spring-boot-dependencies:${spring_boot_version}"
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${spring_cloud_version}"
mavenBom "com.google.inject:guice-bom:${google_guice_version}"
}
dependencies {
dependency("cglib:cglib-nodep:3.2.4")
Expand All @@ -105,17 +106,11 @@ configure(javaProjects) {
dependency("com.github.rholder:guava-retrying:2.0.0")
// Guava even with guava.version set to 19.0 in properties keeps going back to 18.0 without this.
dependency("com.google.guava:guava:19.0")
dependencySet(group: "com.google.inject.extensions", version: "4.0") {
entry "guice-persist"
entry "guice-multibindings"
entry "guice-servlet"
}
dependencySet(group: "com.netflix.spectator", version: "0.55.0") {
entry "spectator-api"
entry "spectator-reg-servo"
}
dependency("com.sun.jersey:jersey-client:1.19.1")
dependency("com.squarespace.jersey2-guice:jersey2-guice:0.5")
dependencySet(group: "io.springfox", version: "2.7.0") {
entry "springfox-swagger2"
entry "springfox-swagger-ui"
Expand All @@ -127,25 +122,30 @@ configure(javaProjects) {
}
dependency("de.danielbechler:java-object-diff:0.91.1")
dependency("io.airlift:testing-mysql-server:0.1")
dependencySet(group: "io.github.openfeign", version: "9.3.1") {
entry "feign-core"
entry "feign-jaxrs"
entry "feign-slf4j"
}
dependency("javax.ws.rs:jsr311-api:1.1.1")
dependency("net.sf.dozer:dozer:5.4.0")
dependency("nl.jqno.equalsverifier:equalsverifier:1.7.2")
dependency("org.apache.hadoop:hadoop-core:1.2.1")
dependencySet(group: "org.apache.hive", version: "1.2.1") {
entry "hive-metastore"
}
dependency("log4j:log4j:1.2.17")
dependency("org.projectlombok:lombok:1.18.4")
dependency("commons-logging:commons-logging:1.2")
dependency("com.datastax.cassandra:cassandra-driver-core:3.6.0")
dependency("org.json:json:20180813")
dependency("com.google.code.findbugs:annotations:3.0.1")
dependency("com.google.code.findbugs:jsr305:3.0.2")
dependency("org.apache.logging.log4j:log4j-core:2.10.0")
dependency("org.apache.pig:pig:0.14.0")
dependency("org.codehaus.gpars:gpars:1.2.1")
dependency("org.glassfish.jersey.containers:jersey-container-servlet:2.19")
dependency("org.glassfish.jersey.media:jersey-media-json-jackson:2.19")
dependency("org.spockframework:spock-core:1.1-groovy-2.4")
dependency("org.spockframework:spock-guice:1.1-groovy-2.4")
dependency("org.spockframework:spock-spring:1.1-groovy-2.4")
dependencySet(group: "org.spockframework", version: "1.1-groovy-2.4") {
entry("spock-core")
entry("spock-guice")
entry("spock-spring")
}
/**es 5.4.1 dependencies*/
dependency("org.elasticsearch.client:transport:5.4.1")
dependency("net.snowflake:snowflake-jdbc:3.4.2")
Expand All @@ -161,6 +161,7 @@ configure(javaProjects) {
all*.exclude module: "log4j-over-slf4j"
all*.exclude module: "slf4j-jdk14"
all*.exclude module: "slf4j-log4j12"
all*.exclude module: "log4j-to-slf4j"
}

dependencies {
Expand All @@ -169,8 +170,12 @@ configure(javaProjects) {
* Compile Dependencies
*******************************/

compile("com.netflix.spectator:spectator-reg-servo")
compile("com.netflix.spectator:spectator-api")
compile("com.google.code.findbugs:annotations")
compile("com.google.code.findbugs:jsr305")
compile("log4j:log4j")
compile("org.springframework.boot:spring-boot-starter-web")

/*******************************
* Provided Dependencies
Expand Down
11 changes: 5 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,20 @@
## Spring Dependency Versions

# Used in documentation and for including the Gradle plugin
spring_boot_version=1.5.9.RELEASE
spring_cloud_version=Edgware.RELEASE
spring_platform_version=Brussels-SR6
spring_boot_version=2.0.8.RELEASE
spring_cloud_version=Finchley.SR2
google_guice_version=4.1.0

## Override Spring Platform IO Versions
## Override Spring Boot versions

elasticsearch.version=5.4.1
guava.version=19.0
guice.version=4.0
jersey.version=2.19
tomcat.version=8.0.22

## Versions Not Covered by Spring BOMs

hive_version=1.2.1

## Gradle Properties

org.gradle.parallel=false
Expand Down
3 changes: 1 addition & 2 deletions metacat-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ jar {
}

springBoot {
mainClass = "com.netflix.metacat.MetacatApplication"
mainClassName = "com.netflix.metacat.MetacatApplication"
}

def env = project.hasProperty("env") ? project.getProperty("env") : "dev"

bootRun {
addResources = false
systemProperty "spring.profiles.active", env
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import lombok.AllArgsConstructor;

import java.io.IOException;
import java.time.Instant;
import java.util.Date;

/**
* Module that provides a error decoder, used to parse errors.
Expand Down Expand Up @@ -77,7 +79,7 @@ public Exception decode(final String methodKey, final Response response) {
return new MetacatTooManyRequestsException(message);
case 500: //INTERNAL_SERVER_ERROR
case 503: //SERVICE_UNAVAILABLE
return new RetryableException(message, null);
return new RetryableException(message, null, new Date(Instant.now().toEpochMilli()));
default:
return new MetacatException(message);
}
Expand Down
1 change: 0 additions & 1 deletion metacat-common-server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ dependencies {
compile("org.slf4j:slf4j-api")
compile("org.springframework.boot:spring-boot-starter")
compile("org.springframework.boot:spring-boot-starter-logging")
compile("org.springframework.cloud:spring-cloud-starter-spectator")
compile("org.springframework:spring-jdbc")


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
public interface TypeManager {
/**
* Gets the type witht the signature, or null if not found.
* Gets the type with the signature, or null if not found.
*
* @param signature type signature
* @return Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ public ObjectNode getAllDataByName(final String dataSourceName) {
public ObjectNode getLatestDataByName(final String dataSourceName) {
String url = String.format(druidURI + "/%s/segments", dataSourceName);
String result = restTemplate.getForObject(url, String.class);
if (result == null) {
throw new MetacatException(String.format("Druid cluster: %s result not found.", dataSourceName));
}
final String latestSegment = DruidHttpClientUtil.getLatestSegment(result);
log.debug("Get the latest segment {}", latestSegment);
url = String.format(druidURI + "/%s/segments/%s", dataSourceName, latestSegment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public void updateIcebergTable(final TableInfo tableInfo) {
throw new InvalidMetaException(tableName, message, null);
}
final Long tableId = getTableId(tableName);
Map<String, String> existingTableMetadata = Maps.newHashMap();
Map<String, String> existingTableMetadata = null;
log.debug("Lock Iceberg table {}", tableName);
try {
existingTableMetadata = jdbcTemplate.query(SQL.TABLE_PARAMS_LOCK,
Expand All @@ -214,6 +214,9 @@ public void updateIcebergTable(final TableInfo tableInfo) {
log.warn(message, ex);
throw new InvalidMetaException(tableName, message, null);
}
if (existingTableMetadata == null) {
existingTableMetadata = Maps.newHashMap();
}
validateIcebergUpdate(tableName, existingTableMetadata, newTableMetadata);
final MapDifference<String, String> diff = Maps.difference(existingTableMetadata, newTableMetadata);
insertTableParams(tableId, diff.entriesOnlyOnRight());
Expand Down
1 change: 0 additions & 1 deletion metacat-connector-pig/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ dependencies {
compile("org.apache.pig:pig")
compile("org.apache.hadoop:hadoop-core")
compile("org.slf4j:slf4j-api")
compile("log4j:log4j")

/*******************************
* Provided Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ services:
-Dnetflix.appinfo.metadata.route53NamePrefix=
-Dnetflix.appinfo.metadata.enableRoute53=false
-Dmetacat.plugin.config.location=/etc/metacat/catalog
-Dmetacat.metrics.default-registry.enabled=true
-Dmetacat.mysqlmetadataservice.enabled=true
-Dmetacat.type.converter=com.netflix.metacat.connector.pig.converters.PigTypeConverter
-Dmetacat.definition.metadata.delete.enableForTable=false
Expand Down
3 changes: 1 addition & 2 deletions metacat-main/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
configurations {
all*.exclude module: "jsr311-api"
all*.exclude module: "slf4j-log4j12"
all*.exclude module: "log4j-to-slf4j"
}

dependencies {
Expand Down Expand Up @@ -51,8 +52,6 @@ dependencies {
compile("org.springframework.boot:spring-boot-starter-hateoas")
compile("org.springframework.boot:spring-boot-starter-logging")
compile("org.springframework.boot:spring-boot-starter-tomcat")
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.cloud:spring-cloud-starter-spectator")

/*******************************
* Provided Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
*/
package com.netflix.metacat.main.api;

import org.springframework.boot.autoconfigure.web.AbstractErrorController;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.servlet.error.AbstractErrorController;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorProperties;
import org.springframework.boot.autoconfigure.web.ErrorViewResolver;
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

import com.netflix.metacat.main.api.ApiFilter;
import com.netflix.metacat.main.api.MetacatErrorController;
import org.springframework.boot.autoconfigure.web.DefaultErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.web.servlet.error.DefaultErrorAttributes;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ErrorProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
Expand Down Expand Up @@ -92,11 +92,11 @@ public ErrorAttributes errorAttributes() {
*/
@Override
public Map<String, Object> getErrorAttributes(
final RequestAttributes requestAttributes,
final WebRequest webRequest,
final boolean includeStackTrace
) {
final Map<String, Object> errorAttributes
= super.getErrorAttributes(requestAttributes, includeStackTrace);
= super.getErrorAttributes(webRequest, includeStackTrace);
errorAttributes.put("error", errorAttributes.get("message"));
return errorAttributes;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
*
* Copyright 2019 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

package com.netflix.metacat.main.configs;

import com.netflix.spectator.api.DefaultRegistry;
import com.netflix.spectator.api.Registry;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* Configuration of Metrics.
*
* @author rveeramacheneni
*/
@Configuration
public class MetricsConfig {

/**
* A default registry.
*
* @return The registry to use.
*/
@Bean
@ConditionalOnProperty(value = "metacat.metrics.default-registry.enabled", havingValue = "true")
public Registry spectatorRegistry() {
return new DefaultRegistry();
}
}
12 changes: 9 additions & 3 deletions metacat-main/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,25 @@
#

management:
contextPath: /actuator
health:
elasticsearch:
enabled: false # This is needed for now as we're using a very out of date ES client that throws runtime errors
security:
enabled: false
endpoints:
web:
exposure:
include: "*"
exclude: httptrace,shutdown

metacat:
metrics:
default-registry:
enabled: true
plugin:
config:
location: /etc/catalog
swagger:
enabled: true

netflix:
appinfo:
name: metacat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;

Expand Down

0 comments on commit db3df1d

Please sign in to comment.