spring boot로 Groovy 앱 만들기(Hello world까지)
5283 단어 Groovyspring-boot
목적
spring boot로 Groovy를 사용하여 간단한 앱을 실행합니다.
이번에는 브라우저에서 Hello world를 표시합니다.
Groovy를 사용하는 이유
Java에서 본격적인 개발의 전리에 간이 버전의 앱을 프로토 타입으로 만드는 데 사용할 수 있습니다.
환경
절차
Groovy 설치
Spring Boot CLT 넣기
htp // // cs. sp 링 g. 이오 / sp 린 g 보오 t / 두 cs / 쿠렌 t / 레후 렌세 / HTML / 껌 . HTML
이번에는 mac를 위해 tar.gz 버전을 다운로드하고,
모든 디렉토리에 배치
패스 붙이기
~/.bash_profile
에 경로 설정
export PATH="$PATH:/workspace_springboot/spring-1.4.0.RELEASE/bin"
PATH="/usr/local/go/bin:$PATH"
다시 로드
source ~/.bash_profile
경로가 올바르게 설정되었는지 확인
echo $PATH
Groovy 코딩
샘플에 다음 파일을 만들고 모든 작업 공간 디렉토리에 넣습니다.
app.groovy@RestController
class App {
@RequestMapping("/")
def home(){
"Hello!!"
}
}
부팅
app.groovy로 이동하여
실행하다
spring run app.groovy
출력
$ spring run app.groovy
Resolving dependencies.......................
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.0.RELEASE)
2016-09-11 01:04:50.048 INFO 4923 --- [ runner-0] o.s.boot.SpringApplication : Starting application on kato-no-MacBook-Air.local with PID 4923 (started by katoyuki in /workspace_springboot/workspace)
2016-09-11 01:04:50.128 INFO 4923 --- [ runner-0] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2016-09-11 01:04:50.666 INFO 4923 --- [ runner-0] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4b1d6420: startup date [Sun Sep 11 01:04:50 JST 2016]; root of context hierarchy
2016-09-11 01:04:54.620 INFO 4923 --- [ runner-0] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-09-11 01:04:54.664 INFO 4923 --- [ runner-0] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-09-11 01:04:54.668 INFO 4923 --- [ runner-0] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.4
2016-09-11 01:04:54.875 INFO 4923 --- [ost-startStop-1] org.apache.catalina.loader.WebappLoader : Unknown loader org.springframework.boot.cli.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader@740ab31 class org.springframework.boot.cli.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader
2016-09-11 01:04:54.922 INFO 4923 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-09-11 01:04:54.922 INFO 4923 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4256 ms
2016-09-11 01:04:55.192 INFO 4923 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-09-11 01:04:55.208 INFO 4923 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'ch
화면 확인
이 상태에서,
http://localhost-8080.com/
브라우저에서 확인
이상,
환경 구축까지,
참고
export PATH="$PATH:/workspace_springboot/spring-1.4.0.RELEASE/bin"
PATH="/usr/local/go/bin:$PATH"
source ~/.bash_profile
echo $PATH
@RestController
class App {
@RequestMapping("/")
def home(){
"Hello!!"
}
}
spring run app.groovy
$ spring run app.groovy
Resolving dependencies.......................
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.4.0.RELEASE)
2016-09-11 01:04:50.048 INFO 4923 --- [ runner-0] o.s.boot.SpringApplication : Starting application on kato-no-MacBook-Air.local with PID 4923 (started by katoyuki in /workspace_springboot/workspace)
2016-09-11 01:04:50.128 INFO 4923 --- [ runner-0] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2016-09-11 01:04:50.666 INFO 4923 --- [ runner-0] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4b1d6420: startup date [Sun Sep 11 01:04:50 JST 2016]; root of context hierarchy
2016-09-11 01:04:54.620 INFO 4923 --- [ runner-0] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2016-09-11 01:04:54.664 INFO 4923 --- [ runner-0] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-09-11 01:04:54.668 INFO 4923 --- [ runner-0] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.4
2016-09-11 01:04:54.875 INFO 4923 --- [ost-startStop-1] org.apache.catalina.loader.WebappLoader : Unknown loader org.springframework.boot.cli.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader@740ab31 class org.springframework.boot.cli.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader
2016-09-11 01:04:54.922 INFO 4923 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-09-11 01:04:54.922 INFO 4923 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 4256 ms
2016-09-11 01:04:55.192 INFO 4923 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-09-11 01:04:55.208 INFO 4923 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'ch
환경은 windows 전제
ぃ tp // 이 m / n bk / / ms / 01 11392921119 0153
Mac에서 경로를 통과하는 방법
htp // // cs. sp 링 g. 이오 / sp 린 g 보오 t / 두 cs / 쿠렌 t / 레후 렌세 / html . HTML
문서
Reference
이 문제에 관하여(spring boot로 Groovy 앱 만들기(Hello world까지)), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/yukihigasi/items/5817ac6efd674df6f214텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)