Last active
August 29, 2015 14:02
-
-
Save jrgleason/e980c4bc4b9f2c47eb13 to your computer and use it in GitHub Desktop.
Super simple Spring REST service, no Groovy but works with external server as well.
This file contains hidden or 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
package com.gleason.itext; | |
import java.util.Arrays; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
import org.springframework.boot.builder.SpringApplicationBuilder; | |
import org.springframework.boot.context.web.SpringBootServletInitializer; | |
import org.springframework.context.annotation.ComponentScan; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.web.bind.annotation.PathVariable; | |
@Configuration | |
@ComponentScan | |
@EnableAutoConfiguration | |
public class Application extends SpringBootServletInitializer { | |
public static void main(String[] args) { | |
SpringApplication.run(applicationClass, args); | |
} | |
@Override | |
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { | |
return application.sources(applicationClass); | |
} | |
private static Class<Application> applicationClass = Application.class; | |
} |
This file contains hidden or 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
buildscript { | |
repositories { | |
mavenLocal() | |
mavenCentral() | |
maven { url "http://repo.spring.io/snapshot" } | |
maven { url "http://repo.spring.io/milestone" } | |
} | |
dependencies { | |
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.1.2.BUILD-SNAPSHOT") | |
} | |
} | |
apply plugin: 'war' | |
apply plugin: 'spring-boot' | |
war { baseName='itext' } | |
repositories { | |
mavenLocal() | |
mavenCentral() | |
maven { url "http://repo.spring.io/snapshot" } | |
maven { url "http://repo.spring.io/milestone" } | |
} | |
dependencies { | |
compile("org.springframework.boot:spring-boot-starter-web") | |
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") | |
testCompile("org.springframework.boot:spring-boot-starter-test") | |
} |
This file contains hidden or 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
package com.gleason.itext.controllers; | |
import org.springframework.web.bind.annotation.RequestMapping; | |
import org.springframework.web.bind.annotation.RestController; | |
@RestController | |
public class GreetingController { | |
@RequestMapping("/") | |
public String test(){ | |
System.out.println("Test"); | |
return "Test"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment