SprintBoot start

#The 3 ways to run Spring Boot application

1. In IntelliJ IDEA Ultimate
@SpringBootApplication
pubic class TestApplication{...}
@RestController
public class otherController{
 @RequestMapping(value="/hello", method=RequestMethod.Get)
 public String say(){return "test";}
run 'TestApplicaton'

2.mvn spring-boot.run
cd projectfolder
mvn spring-boot.run

3.java -jar
mvn install
cd target
 > java -jar  projectname-0.0.1-SNAPSHOT.jar

#Springboot2.4.4 and Log4j2
---------------------------------------------------------------------------
##1.1 For console color text, set disableAnsi="false";
##1.2  log4j conflict, using <exclusions>;
##1.3 no showing in console,  must be run after SpringApplication.run(MailApplication.class, args);

<Console name="Console" target="SYSTEM_OUT">
            <PatternLayout disableAnsi="false"
                           pattern="%style{%d{ISO8601}}{black} %highlight{%-5level }[%style{%t}{bright,blue}] %style{%C{1.}}{bright,yellow}: %msg%n%throwable" />
        </Console>
-------------------------------------
<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
---------------------------------------------------------------------------
public static void main(String[] args) {
 System.out.println("xx");  //not output
        SpringApplication.run(MailApplication.class, args);
System.out.println("xx");  //output
    }
---------------------------------------------------------------------------

评论

此博客中的热门博文

XML, XSL, HTML

Input in element.eleme.io

Data URI是由RFC 2397 ACE