cmd运行springboot项目:
①
mvn springboot:run
②
mvn install
cd target
java -jar girl-0.0.1-SNAPSHOT.jar
2.构建sprignboot项目
1.gradle +springboot 2.1.2 https://start.spring.io/
2.编译运行cmd-build successful
java -version
gradle -v
cd D:\codes\IDEA\initialize-start
d:
gradle build
java -jar build/libs/initialize-start-1.0.0.jar
3.Junit test,status()、content()报错
public class HelloControllerTest {
@Autowired
private MockMvc mockMvc;
@Test
public void testHello() throws Exception {
mockMvc.perform(MockMvcRequestBuilders.get("/hello").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string(equalTo("Hello World")));
}
}
导入:
import static org.hamcrest.Matchers.equalTo;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
4.springboot项目三种运行方式
java -jar build/libs/initialize-start-1.0.0.jar
java Application
spring Boot Gradle Plugin
cd D:\codes\IDEA\hello-world
d:
gradle bootRun
gradlew bootRun
5.thymeleaf的属性优先级,Thymeleaf相关文档:https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#introducing-thymeleaf
优先级 | 标签 |
1 | th:include th:replace |
2 | th:each |
3 | th:if th:unless th:switch th:case |
4 | th:object th:with |
5 | th:attr th:attrprepend th:attrappend |
6 | th:value,th:href,th.src,etc |
7 | th:text th:utext |
8 | th:fragment |
9 | th:remove |
6.thymeleaf无法识别标签th:
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
7.Eclipse无法识别中文的问题