μ€νλ§μ μ΄μ©ν΄ λΉ λ₯΄κ² κ°νΈνκ² νλ‘ν νμ΄νμ λ§λ€μ΄ λ³Ό μ μκ² λμμ£Όλ 컀맨λλΌμΈ ν΄
Groovy μ€ν¬λ¦½νΈ μΌλ‘λ§ νλ‘κ·Έλλ° κ°λ₯
μλ° 1.6λ²μ μ΄μμ νμ
zsh/bash μλμμ± κΈ°λ₯μ§μ
$ spring <TAB>
encodepassword -- Encode a password for use with Spring Security
grab -- Download a spring groovy script's dependencies to ./repository
help -- Get help on commands
init -- Initialize a new project using Spring Initializr (start.spring.io)
install -- Install dependencies to the lib/ext directory
jar -- Create a self-contained executable jar file from a Spring Groovy script
run -- Run a spring groovy script
shell -- Start a nested shell
uninstall -- Uninstall dependencies from the lib/ext directory
version -- Show the version
war -- Create a self-contained executable war file from a Spring Groovy script
$ brew update
$ brew tap pivotal/tap
$ brew install springboot
macOSλ§ κΈ°μ¬ν΄λλλ° Windows μ€μΉλ JournalDev λΈλ‘κ·Έ μ μΉμ ν μ€λͺ
λμ΄ μμ
Spring-boot CLI νμ©μ
$ spring encodepassword "helloworld"
{bcrypt}$2a$10$4tdL/kPzseCki6gj.i9CSe6Azyg7xE3oKqTucjbf5dy6xLS2uTWb6
@RestController
class WebApplication {
@RequestMapping("/")
String home() {
"Hello World!"
}
}
Web μ ν리μΌμ΄μ
μ€ν
$ spring run hello.groovy
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (jar:file:/usr/local/Cellar/springboot/2.2.1.RELEASE/lib/spring-boot-cli-2.2.1.RELEASE.jar!/BOOT-INF/lib/groovy-2.5.8.jar!/) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.1.RELEASE)
2020-03-06 23:33:18.239 INFO 65352 --- [ runner-0] o.s.boot.SpringApplication : Starting application on 01L0217075471DD with PID 65352 (started by daekwon.kang in /Users/daekwon.kang/Code/mine/temp)
2020-03-06 23:33:18.248 INFO 65352 --- [ runner-0] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2020-03-06 23:33:19.271 INFO 65352 --- [ runner-0] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-03-06 23:33:19.290 INFO 65352 --- [ runner-0] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-03-06 23:33:19.290 INFO 65352 --- [ runner-0] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.27]
2020-03-06 23:33:19.341 INFO 65352 --- [ runner-0] org.apache.catalina.loader.WebappLoader : Unknown class loader [org.springframework.boot.cli.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader@1bc6a36e] of class [class org.springframework.boot.cli.compiler.ExtendedGroovyClassLoader$DefaultScopeParentClassLoader]
2020-03-06 23:33:19.388 INFO 65352 --- [ runner-0] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-03-06 23:33:19.388 INFO 65352 --- [ runner-0] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 976 ms
2020-03-06 23:33:19.577 INFO 65352 --- [ runner-0] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-03-06 23:33:19.942 INFO 65352 --- [ runner-0] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-03-06 23:33:19.946 INFO 65352 --- [ runner-0] o.s.boot.SpringApplication : Started application in 2.358 seconds (JVM running for 4.514)
2020-03-06 23:34:00.558 INFO 65352 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-03-06 23:34:00.558 INFO 65352 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-03-06 23:34:00.570 INFO 65352 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 12 ms
Web μ ν리μΌμ΄μ
ν
μ€νΈ
$ curl localhost:8080
Hello World!