springboot-02

spring boot 独立运行,整合框架

1.设置spring boot的parent

<parent>

      <groupId>org.springframework.boot</groupId>

      <artifactId>spring-boot-starter-parent</artifactId>

      <version>1.5.2.RELEASE</version>

   </parent>

 说明:Spring boot的项目必须要将parent设置为spring boot的parent

2.  导入spring boot的web支持

<dependency>

        <groupId>org.springframework.boot</groupId>

        <artifactId>spring-boot-starter-web</artifactId>

      </dependency>

3.  添加Spring boot的插件(不是必须的):为了进行  spring-boot:run  运行程序

<plugin>

           <groupId>org.springframework.boot</groupId>

           <artifactId>spring-boot-maven-plugin</artifactId>

<plugin>


@SpringBootApplication:Spring Boot项目的核心注解,主要目的是开启自动配置

SpringBootApplication其实是一个组合注解

自定义banner

打开网站:

http://patorjk.com/software/taag/#p=display&h=3&v=3&f=4Max&t=itcast%20Spring%20Boot

拷贝生成的字符到一个文本文件中,并且将该文件命名为banner.txt

将banner.txt拷贝到项目的resources目录中:

SpringBoot项目使用一个全局的配置文件application.properties或者是application.yml,在resources目录下或者类路径下的/config下,一般我们放到resources下

修改端口:  

server.port=8088   修改tomcat的端口为8088

server.servlet-path=*.html    修改进入DispatcherServlet的规则为:*.html

spring.resources.static-locations=classpath:/public/

logging.level.org.springframework=DEBUG

Starter pom :提供自动配置的bean


猜你喜欢

转载自blog.csdn.net/qq_41875147/article/details/79878120