BAEL-1635: Spring Boot CLI (#3886)
* BAEL-1635: Spring Boot CLI * Modified packages for consistent naming
This commit is contained in:
committed by
KevinGilmore
parent
6549e41afa
commit
323f5bf370
@@ -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