This repository has been archived by the owner on Sep 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from gigaSproule/feature/add-scala
Feature/add scala
- Loading branch information
Showing
33 changed files
with
947 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#Sat Sep 29 17:44:24 BST 2018 | ||
#Thu Nov 29 22:20:24 GMT 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
buildscript { | ||
ext { | ||
springBootVersion = '1.5.4.RELEASE' | ||
} | ||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" | ||
classpath 'com.benjaminsproule:swagger-gradle-plugin:+' | ||
} | ||
} | ||
|
||
apply plugin: 'scala' | ||
apply plugin: 'org.springframework.boot' | ||
apply plugin: 'com.benjaminsproule.swagger' | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
group = 'com.benjaminsproule' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
dependencies { | ||
compile 'org.scala-lang:scala-library:2.12.7' | ||
compile 'org.springframework.boot:spring-boot-starter-jersey' | ||
compile 'org.springframework.boot:spring-boot-starter-web' | ||
compile 'io.swagger:swagger-annotations:1.5.15' | ||
compile 'javax.ws.rs:javax.ws.rs-api:2.0.1' | ||
} | ||
|
||
swagger { | ||
apiSource { | ||
springmvc = false | ||
locations = ['com.benjaminsproule.sample'] | ||
schemes = ['http', 'https'] | ||
host = 'www.example.com:8080' | ||
basePath = '/sample' | ||
info { | ||
title = 'Swagger Gradle Plugin Sample' | ||
version = 'v1' | ||
description = 'This is a sample.' | ||
termsOfService = 'http://www.example.com/termsOfService' | ||
contact { | ||
email = '[email protected]' | ||
name = 'Name' | ||
url = 'http://www.example.com' | ||
} | ||
license { | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.html' | ||
name = 'Apache 2.0' | ||
} | ||
} | ||
swaggerDirectory = "${project.buildDir}/swagger-ui" | ||
securityDefinition { | ||
json = 'securityDefinition.json' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'scala-spring-boot-jaxrs' |
16 changes: 16 additions & 0 deletions
16
sample/scala-spring-boot-jaxrs/src/main/resources/securityDefinition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"api_key": { | ||
"type": "apiKey", | ||
"name": "api_key", | ||
"in": "header" | ||
}, | ||
"petstore_auth": { | ||
"type": "oauth2", | ||
"authorizationUrl": "http://swagger.io/api/oauth/dialog", | ||
"flow": "implicit", | ||
"scopes": { | ||
"write:pets": "modify pets in your account", | ||
"read:pets": "read your pets" | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...spring-boot-jaxrs/src/main/scala/com/benjaminsproule/sample/scala/SampleApplication.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.benjaminsproule.sample.scala | ||
|
||
import org.springframework.boot.SpringApplication | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
|
||
@SpringBootApplication | ||
class SampleApplication extends App { | ||
SpringApplication.run(classOf[SampleApplication], args: _ *) | ||
} |
9 changes: 9 additions & 0 deletions
9
...cala-spring-boot-jaxrs/src/main/scala/com/benjaminsproule/sample/scala/SampleConfig.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.benjaminsproule.sample.scala | ||
|
||
import org.glassfish.jersey.server.ResourceConfig | ||
import org.springframework.context.annotation.Configuration | ||
|
||
@Configuration | ||
class SampleConfig extends ResourceConfig { | ||
register(classOf[SampleResource]) | ||
} |
17 changes: 17 additions & 0 deletions
17
...la-spring-boot-jaxrs/src/main/scala/com/benjaminsproule/sample/scala/SampleResource.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.benjaminsproule.sample.scala | ||
|
||
import io.swagger.annotations.{Api, ApiOperation} | ||
import javax.ws.rs.{GET, Path, Produces} | ||
import org.springframework.stereotype.Controller | ||
|
||
@Controller | ||
@Path("/sample") | ||
@Produces(Array("application/json")) | ||
@Api(value = "/sample", description = "Sample REST for Integration Testing") | ||
class SampleResource { | ||
@GET | ||
@ApiOperation(value = "Return hello message", response = classOf[String]) | ||
def home: String = { | ||
"{\"Hello\": \"World!\"}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
buildscript { | ||
ext { | ||
springBootVersion = '1.5.4.RELEASE' | ||
} | ||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
jcenter() | ||
} | ||
dependencies { | ||
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion" | ||
classpath 'com.benjaminsproule:swagger-gradle-plugin:+' | ||
} | ||
} | ||
|
||
apply plugin: 'scala' | ||
apply plugin: 'org.springframework.boot' | ||
apply plugin: 'com.benjaminsproule.swagger' | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
jcenter() | ||
} | ||
|
||
group = 'com.benjaminsproule' | ||
version = '0.0.1-SNAPSHOT' | ||
|
||
dependencies { | ||
compile 'org.scala-lang:scala-library:2.12.7' | ||
compile 'org.springframework.boot:spring-boot-starter-web' | ||
compile 'io.swagger:swagger-annotations:1.5.15' | ||
} | ||
|
||
swagger { | ||
apiSource { | ||
springmvc = true | ||
locations = ['com.benjaminsproule.sample'] | ||
schemes = ['http', 'https'] | ||
host = 'www.example.com:8080' | ||
basePath = '/sample' | ||
info { | ||
title = 'Swagger Gradle Plugin Sample' | ||
version = 'v1' | ||
description = 'This is a sample.' | ||
termsOfService = 'http://www.example.com/termsOfService' | ||
contact { | ||
email = '[email protected]' | ||
name = 'Name' | ||
url = 'http://www.example.com' | ||
} | ||
license { | ||
url = 'http://www.apache.org/licenses/LICENSE-2.0.html' | ||
name = 'Apache 2.0' | ||
} | ||
} | ||
swaggerDirectory = "${project.buildDir}/swagger-ui" | ||
securityDefinition { | ||
json = 'securityDefinition.json' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'scala-spring-boot-mvc' |
16 changes: 16 additions & 0 deletions
16
sample/scala-spring-boot-mvc/src/main/resources/securityDefinition.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"api_key": { | ||
"type": "apiKey", | ||
"name": "api_key", | ||
"in": "header" | ||
}, | ||
"petstore_auth": { | ||
"type": "oauth2", | ||
"authorizationUrl": "http://swagger.io/api/oauth/dialog", | ||
"flow": "implicit", | ||
"scopes": { | ||
"write:pets": "modify pets in your account", | ||
"read:pets": "read your pets" | ||
} | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
...a-spring-boot-mvc/src/main/scala/com/benjaminsproule/sample/scala/SampleApplication.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.benjaminsproule.sample.scala | ||
|
||
import org.springframework.boot.SpringApplication | ||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
|
||
@SpringBootApplication | ||
class SampleApplication extends App { | ||
SpringApplication.run(classOf[SampleApplication], args: _ *) | ||
} |
15 changes: 15 additions & 0 deletions
15
...la-spring-boot-mvc/src/main/scala/com/benjaminsproule/sample/scala/SampleController.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.benjaminsproule.sample.scala | ||
|
||
import io.swagger.annotations.{Api, ApiOperation} | ||
import org.springframework.web.bind.annotation.{RequestMapping, RequestMethod, RestController} | ||
|
||
@RestController | ||
@Api(value = "/sample", description = "Sample REST for Integration Testing") | ||
class SampleController { | ||
|
||
@RequestMapping(method = Array(RequestMethod.GET), path = Array("/sample"), produces = Array("application/json")) | ||
@ApiOperation(value = "Return hello message", response = classOf[String]) | ||
def home: String = { | ||
"{\"Hello\": \"World!\"}" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.