minte9
LearnRemember




Spring

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.6.3-bin.tar.gz -C /opt/spring-boot/

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

spring --version # Spring CLI v2.6.3
sprint init --list

Password

Avoid storing raw password, bcrypt it with and Spring CLI.
 
spring encodepassword mypass

# {bcrypt}$2a$10$2wRXv3x28CiFAq966H93PeAvaRHKMF.ItkMC.CsPBdYTZ2xLO2sLy
 
# src/resources/application.properties

spring.security.user.name=myuser
spring.security.user.password={bcrypt}$2a$10$2wRXv3x28CiFAq966H93...

Run

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
 */

@RestController
class App {

    @RequestMapping("/") 
    String home() {
        "Hello Groovy"
    }
}
 
spring run src/main/java/com/minte9/command_line/App.groovy

http://localhost:8080
    # Hello Groovy

Jar

Use jar command to package the application.
 
cd src/main/java/com/minte9/command_line/
spring jar hello.jar *.groovy

cd target/classes/com/minte9/command_line/
java -jar hello.jar



  Last update: 211 days ago