虚拟主机怎么设计网站,qq邮箱官方网站,wordpress标签后缀名html,深圳福田区房价多少钱一平米什么是springboot sprng家族一个全新的框架 简化我们应用程序的创建和开发的过程#xff0c;使用默认配置简化了我们以前传统的配置 springboot的特性 能够快速创建spring程序能够使用java main方法启动内嵌的 tomcat 或者jetty服务器运行spring boot程序提供约定的starter p… 什么是springboot sprng家族一个全新的框架 简化我们应用程序的创建和开发的过程使用默认配置简化了我们以前传统的配置 springboot的特性 能够快速创建spring程序 能够使用java main方法启动内嵌的 tomcat 或者jetty服务器运行spring boot程序 提供约定的starter pom简化maven配置 让maven变得更简单 根据maven依赖配置 spring boot自动配置spring spring mvc等 提供程序内部运行情况的检查功能 完全不适用xml配置文件 采用的是注解配置 spring四大核心 自动配置 针对spring应用程序和常见的应用功能 spring boot能自动提供相关配置(用的多) 起步依赖告诉springboot需要什么功能 自动引入相关库(用的多) actuator能够深入的运行中的spring boot应用程序 看spring boot的内部信息 命令行界面spring boot的可选特性 主要针对 Groovy语言使用 创建并运行一个SpringBoot项目(IDEA) 项目结构 spring boot 入口类 package com.liqiang;import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;SpringBootApplication
public class SpringBootHellwordApplication {public static void main(String[] args) {SpringApplication.run(SpringBootHellwordApplication.class, args);}
} SpringBootApplication是一个组合注解 Target(ElementType.TYPE)
Retention(RetentionPolicy.RUNTIME)
Documented
Inherited
SpringBootConfiguration
EnableAutoConfiguration
ComponentScan(excludeFilters Filter(type FilterType.CUSTOM, classes TypeExcludeFilter.class))
public interface SpringBootApplication {//排除自启动项Class?[] exclude() default {};//排除自动启动的beanNameString[] excludeName() default {};//扫描包AliasFor(annotation ComponentScan.class, attribute basePackages)String[] scanBasePackages() default {};//扫描类AliasFor(annotation ComponentScan.class, attribute basePackageClasses)Class?[] scanBasePackageClasses() default {};} 测试运行 1.创建一个controller(必须放在入口类的包下面。应该spring boot会扫描入口类包下面的所有类) package com.liqiang.contorller;import org.springframework.web.bind.annotation.RestController;RestController
public class HelloWordContorller {public String helloWord(){return helloWord;}
} 2.在pom增加maven插件 plugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactId/plugin 3.配置maven启动命令 选中我们配置 启动 访问 以前创建一个springmvc项目需要 1.引入一系列spring mvc依赖包 2.springmvc sevlet配置DispatcherServlet 3.创建spring mvc核心配置文件 配置扫描包 配置处理映射器和处理适配器 转载于:https://www.cnblogs.com/LQBlog/p/9224317.html