PROGRAMMING

m9/ JAVA
REMEMBERS




Last update:   17-09-2021

SPRING CLI

Spring Boot CLI is a command line tool used to quickly develop a Spring application.
 
sudo mkdir /opt/spring-boot
sudo tar xzf spring-boot-cli-2.5.4-bin.tar.gz -C /opt/spring-boot/

sudo gedit /etc/profile
    # export SPRING_HOME=/opt/spring-boot/spring-2.5.4
    # export PATH=$SPRING_HOME/bin:$PATH

source /etc/profile
spring --version
    # Spring CLI v2.5.4
... 2 lines
 
Generate bcrypt passwords with encodepassword command.
 
spring encodepassword mypass
    # {bcrypt}$2a$10$G7VG4tP1wgOfTtCnjVPYWO2V7/RXAkkMp9b4i7ZgEyRaEuMmPcodK
Compile and run Groovy source code with spring.
 
/**
 * Standard Groovy includes a Grab annotation ...
 * to declare dependencies.
 * 
 * With RestController annotation ... 
 * Spring Boot grabs Tomcat and Spring Mvc.
 */


// ~java/SpringBoot/groovy/hello/App.groovy

@RestController
class App {

    @RequestMapping("/") 
    String home() {
        "Hello World"
    }
}
... 9 lines
 
 
spring run App.groovy    # -- --server.port=9000

http://localhost:8080
    # Hello World
Use jar coomand to package the application.
 
spring jar hello.jar *.groovy

java -jar hello.jar
Initialize a new project with init command.
 
spring init --dependencies=web,security myproject
cd myproject

./mvnw spring-boot:ron

http://localhost:8080
    # Please sign in

Questions    
Scheduling-Tasks

        A B C D E F
🔔
1/1