BAEL-20869 Move remaining spring boot modules
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
## Spring Boot CLI
|
||||
|
||||
This module contains articles about Spring Boot CLI
|
||||
|
||||
### Relevant Articles:
|
||||
- [Introduction to Spring Boot CLI](https://www.baeldung.com/spring-boot-cli)
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Run Groovy Service or Script"
|
||||
echo "spring run app.groovy"
|
||||
spring run app.groovy
|
||||
echo
|
||||
|
||||
echo "Watch Groovy Service or Script"
|
||||
echo "spring run app.groovy --watch"
|
||||
spring run app.groovy --watch
|
||||
echo
|
||||
|
||||
echo "Spring Shell"
|
||||
echo "spring shell"
|
||||
spring shell
|
||||
echo "now enter a spring command..."
|
||||
echo
|
||||
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Install SDKMan"
|
||||
sudo apt-get update
|
||||
sudo apt-get install unzip zip -y
|
||||
sudo curl -s get.sdkman.io | bash
|
||||
sudo source "$HOME/.sdkman/bin/sdkman-init.sh"
|
||||
sdk version
|
||||
|
||||
echo "Install Spring Dependencies"
|
||||
sudo sdk install groovy
|
||||
sudo sdk install java
|
||||
sudo sdk install maven
|
||||
|
||||
echo "Install Spring Boot"
|
||||
sudo sdk install springboot
|
||||
spring --version
|
||||
|
||||
# Spring Boot CLI Proper
|
||||
# sdk install springboot dev /path/to/spring-boot/spring-boot-cli/target/spring-boot-cli-2.0.0.RELEASE-bin/spring-2.0.0.RELEASE/
|
||||
# sdk default springboot dev
|
||||
# spring --version
|
||||
@@ -0,0 +1,23 @@
|
||||
package bael.data
|
||||
|
||||
@Grab('h2')
|
||||
|
||||
import org.springframework.context.annotation.Bean
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc
|
||||
import javax.sql.DataSource
|
||||
|
||||
@Configuration
|
||||
@EnableWebMvc
|
||||
@ComponentScan('bael.data')
|
||||
class DataConfig {
|
||||
|
||||
@Bean
|
||||
DataSource dataSource() {
|
||||
return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package bael.security
|
||||
|
||||
@Grab("spring-boot-starter-security")
|
||||
|
||||
@RestController
|
||||
class SampleController {
|
||||
|
||||
@RequestMapping("/")
|
||||
public def example() {
|
||||
[message: "Hello World!"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package bael.test
|
||||
|
||||
@Grab('junit')
|
||||
@Log
|
||||
|
||||
class Test {
|
||||
|
||||
static void main(String[] args) {
|
||||
log.info "Test..."
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package bael.yml
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder
|
||||
import org.springframework.context.annotation.ComponentScan
|
||||
|
||||
@EnableAutoConfiguration
|
||||
@ComponentScan('bael.yml')
|
||||
class App {
|
||||
|
||||
static void main(String[] args) {
|
||||
new SpringApplicationBuilder()
|
||||
.sources(App)
|
||||
.run(args)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
spring:
|
||||
port: 8081
|
||||
Reference in New Issue
Block a user