diff --git a/pom.xml b/pom.xml index 560a63c..668332d 100644 --- a/pom.xml +++ b/pom.xml @@ -19,14 +19,16 @@ org.springframework.boot spring-boot-starter-parent - 1.5.10.RELEASE + + 2.0.0.RELEASE + - + org.springframework.boot spring-boot-starter-web @@ -72,7 +74,7 @@ com.h2database h2 - test + org.postgresql @@ -82,31 +84,81 @@ org.springframework.boot spring-boot-starter-tomcat - provided + io.springfox springfox-swagger2 - 2.8.0 + + 3.0.0-SNAPSHOT io.springfox springfox-swagger-ui - 2.8.0 + + 3.0.0-SNAPSHOT io.springfox springfox-data-rest - 2.8.0 + + 3.0.0-SNAPSHOT io.springfox springfox-bean-validators - 2.8.0 + + 3.0.0-SNAPSHOT + + + + io.springfox + springfox-spring-webflux + 3.0.0-SNAPSHOT + + + + org.springframework.boot + spring-boot-starter-security + + + + org.springframework.boot + spring-boot-properties-migrator + + + org.springframework.security.oauth.boot + spring-security-oauth2-autoconfigure + + 2.1.4.RELEASE + + + + + + + + + + + jcenter-snapshots + jcenter + http://oss.jfrog.org/artifactory/oss-snapshot-local/ + + + ${buildDirectory} diff --git a/src/main/java/uk/ac/ebi/ampt2d/registry/PropertyRegistryServiceApplication.java b/src/main/java/uk/ac/ebi/ampt2d/registry/PropertyRegistryServiceApplication.java index 6218e79..100b6f7 100644 --- a/src/main/java/uk/ac/ebi/ampt2d/registry/PropertyRegistryServiceApplication.java +++ b/src/main/java/uk/ac/ebi/ampt2d/registry/PropertyRegistryServiceApplication.java @@ -20,17 +20,22 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.support.SpringBootServletInitializer; +//import org.springframework.boot.web.support.SpringBootServletInitializer; +//import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 2.x +import org.springframework.core.SpringVersion; @SpringBootApplication -public class PropertyRegistryServiceApplication extends SpringBootServletInitializer { +public class PropertyRegistryServiceApplication {//} extends SpringBootServletInitializer { public static void main(String[] args) throws Exception { + + System.out.println("version===: " + SpringVersion.getVersion()); + SpringApplication.run(PropertyRegistryServiceApplication.class, args); } - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - return application.sources(PropertyRegistryServiceApplication.class); - } +// @Override +// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { +// return application.sources(PropertyRegistryServiceApplication.class); +// } } diff --git a/src/main/java/uk/ac/ebi/ampt2d/registry/config/SwaggerConfiguration.java b/src/main/java/uk/ac/ebi/ampt2d/registry/config/SwaggerConfiguration.java index 79d60fd..dfe019c 100644 --- a/src/main/java/uk/ac/ebi/ampt2d/registry/config/SwaggerConfiguration.java +++ b/src/main/java/uk/ac/ebi/ampt2d/registry/config/SwaggerConfiguration.java @@ -18,8 +18,8 @@ package uk.ac.ebi.ampt2d.registry.config; import com.fasterxml.classmate.TypeResolver; -import com.google.common.base.Predicate; -import com.google.common.base.Predicates; +//import com.google.common.base.Predicate; +//import com.google.common.base.Predicates; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -43,7 +43,9 @@ import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger.web.UiConfiguration; import springfox.documentation.swagger.web.UiConfigurationBuilder; -import springfox.documentation.swagger2.annotations.EnableSwagger2; +//import springfox.documentation.swagger2.annotations.EnableSwagger2; +import springfox.documentation.swagger2.annotations.EnableSwagger2WebFlux; + import java.lang.reflect.WildcardType; import java.util.Arrays; @@ -51,12 +53,13 @@ import static springfox.documentation.schema.AlternateTypeRules.newRule; @Configuration -@EnableSwagger2 -@Import({SpringDataRestConfiguration.class, BeanValidatorPluginsConfiguration.class}) +//@EnableSwagger2 +@EnableSwagger2WebFlux +@Import({/*SpringDataRestConfiguration.class, */BeanValidatorPluginsConfiguration.class}) public class SwaggerConfiguration { - @Autowired - private TypeResolver typeResolver; +// @Autowired +// private TypeResolver typeResolver; private SecurityReference securityReference = SecurityReference.builder() .reference("Authorization").scopes(new AuthorizationScope[0]).build(); @@ -69,8 +72,10 @@ public Docket propertyRegistryApi() { return new Docket(DocumentationType.SWAGGER_2) .select() .apis(RequestHandlerSelectors.any()) - .paths(getScanRestServicesPathPredicate()) + .paths(PathSelectors.any()) //getScanRestServicesPathPredicate()) +// .paths(getScanRestServicesPathPredicate()) .build() +/* .apiInfo(getApiInfo()) .pathMapping("/") .tags( @@ -81,17 +86,18 @@ public Docket propertyRegistryApi() { .securitySchemes(Arrays.asList(new ApiKey("Authorization", "Authorization", "header"))) .securityContexts(Arrays.asList(securityContext)) .alternateTypeRules(getSubstitutionRules()); - +*/ +; } - private Predicate getScanRestServicesPathPredicate() { +/* private Predicate getScanRestServicesPathPredicate() { return Predicates.and( Predicates.not(PathSelectors.regex("/actuator.*")), // Hide spring-actuator Predicates.not(PathSelectors.regex("/error.*")), // Hide spring-data error Predicates.not(PathSelectors.regex("/profile.*")),// Hide spring-data profile Predicates.not(PathSelectors.regex("/users.*")) // Hide user-profile ); - } + }*/ private ApiInfo getApiInfo() { return new ApiInfoBuilder() @@ -105,11 +111,11 @@ private ApiInfo getApiInfo() { .build(); } - private AlternateTypeRule getSubstitutionRules() { - return newRule(typeResolver.resolve(DeferredResult.class, - typeResolver.resolve(ResponseEntity.class, WildcardType.class)), - typeResolver.resolve(WildcardType.class)); - } +// private AlternateTypeRule getSubstitutionRules() { +// return newRule(typeResolver.resolve(DeferredResult.class, +// typeResolver.resolve(ResponseEntity.class, WildcardType.class)), +// typeResolver.resolve(WildcardType.class)); +// } @Bean UiConfiguration uiConfig() { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8494936..cdda0fc 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,25 +1,27 @@ spring.application.name=ampt2d-property-registry # Bean jmx domain for actuator when using multiple applications with tomcat. -endpoints.jmx.domain=ampt2d-property-registry +#endpoints.jmx.domain=ampt2d-property-registry +management.endpoints.jmx.domain=ampt2d-property-registry spring.jmx.default-domain=ampt2d-property-registry -management.security.enabled=false +#management.security.enabled=false -management.context-path=/actuator +#management.context-path=/actuator +management.server.servlet.context-path=/actuator management.endpoint.health.show-details=always -endpoints.health.sensitive=false +#endpoints.health.sensitive=false -spring.datasource.url=@ampt2d-property-registry-db.url@ -spring.datasource.username=@ampt2d-property-registry-db.username@ -spring.datasource.password=@ampt2d-property-registry-db.password@ -spring.jpa.hibernate.ddl-auto=none -spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL94Dialect -spring.jpa.generate-ddl=true +#spring.datasource.url=@ampt2d-property-registry-db.url@ +#spring.datasource.username=@ampt2d-property-registry-db.username@ +#spring.datasource.password=@ampt2d-property-registry-db.password@ +#spring.jpa.hibernate.ddl-auto=none +#spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL94Dialect +#spring.jpa.generate-ddl=true security.enabled=true security.oauth2.resource.userInfoUri=https://www.googleapis.com/userinfo/v2/me -security.oauth2.resource.filter-order=3 +#security.oauth2.resource.filter-order=3 spring.mail.host=@smtp-host@ spring.mail.port=587 @@ -31,4 +33,6 @@ mail.from=@amp-t2d-email-id@ mail.to=@amp-t2d-email-id@ mail.subject=AMP-T2D Registry Update -registry.protocols=https \ No newline at end of file +registry.protocols=https + +server.port = 8082 \ No newline at end of file diff --git a/src/test/java/uk/ac/ebi/ampt2d/registry/RegistryUpdateNotificationFailure.java b/src/test/java/uk/ac/ebi/ampt2d/registry/RegistryUpdateNotificationFailure.java index 723763a..96bb7dc 100644 --- a/src/test/java/uk/ac/ebi/ampt2d/registry/RegistryUpdateNotificationFailure.java +++ b/src/test/java/uk/ac/ebi/ampt2d/registry/RegistryUpdateNotificationFailure.java @@ -17,6 +17,7 @@ */ package uk.ac.ebi.ampt2d.registry; +import com.fasterxml.classmate.TypeResolver; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -41,6 +42,9 @@ @DirtiesContext(classMode = BEFORE_CLASS) public class RegistryUpdateNotificationFailure { + @Autowired + private TypeResolver typeResolver; + @Autowired private MockMvc mockMvc; diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 95d207a..28e3c47 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -1,14 +1,16 @@ spring.application.name=ampt2d-property-registry # Bean jmx domain for actuator when using multiple applications with tomcat. -endpoints.jmx.domain=ampt2d-property-registry +#endpoints.jmx.domain=ampt2d-property-registry +management.endpoints.jmx.domain=ampt2d-property-registry spring.jmx.default-domain=ampt2d-property-registry -management.security.enabled=false +#management.security.enabled=false -management.context-path=/actuator +#management.context-path=/actuator +management.server.servlet.context-path=/actuator management.endpoint.health.show-details=always -endpoints.health.sensitive=false +#endpoints.health.sensitive=false registry.protocols=http spring.jpa.hibernate.ddl-auto=create