Spring Boot 入门

xiaoxiao2021-02-28  12

Spring Boot

是一款让你快速起步的框架,它封装了套路 [COC: convention over configuration 惯例优于配置] Spring boot具有jar包检测机制,会将检测到的jar包自动配置好 Spring聚套路于一身,可实现快速生成maven项目 在spring boot官网http://projects.spring.io/spring-boot/ 点击

中的红色框中的start.spring.io, 进入快速生成项目的页面,按照需求,填入依赖,创建一个项目

RELEASE正式版本 SNAPSHOT开发者版本

使用springMVC那一套,创建controller、model等等 *:SbwebApplication.java放在顶层包下面

运行Sewebapplication.java 在之前讲过的Restlet Client插件上测试

*: 一个微服务不应过于复杂 占有一个端口,只需运行在根目录下,不像用Tomcat,有几个项目,需要填项目名。若是还有其他微服务,则另外再加端口。

你也可以手动配置bean,如果你手动配置了bean,就会按照你自己配置的bean来 建立AppConfig,配置freemarker控制器FreeMarkerConfigurer和视图解析器ViewResolver 按照bean的内容改写成Java 可查看spring-framework-reference –> Part VI.The Web –> 23.View technoligies –> 23.4 Velovity&FreeMarker Context configuration

<bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"> <property name="cache" value="true"/> <property name="prefix" value=""/> <property name="suffix" value=".ftl"/> </bean>
转载请注明原文地址: https://www.6miu.com/read-450200.html

最新回复(0)