Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback. Tue Jun 30 17:24:02 CST 2015 There was an unexpected error (type=Not Found, status=404). No message available
1
那么就是因为你所创建的包不在springboot的主配置类所在包内,点击查看详情
什么叫做springboot的主配置类
含有注解@SpringBootApplication的类,比如默认创建好的主配置类是这样子的:
package com.test.HelloWord;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HelloWordApplication {
public static void main(String[] args) {
SpringApplication.run(HelloWordApplication.class, args);
}
}
spring 在启动时会根据D:\MAVENRes\org\springframework\boot\spring-boot-autoconfigure\2.1.0.RELEASE\spring-boot-autoconfigure-2.1.0.RELEASE.jar下面的/META-INF/spring.factories自动加载第三方jar包
@RunWith(SpringRunner.class)
@SpringBootTest
public class HelloWordApplicationTests {
@Autowired
StudentPo stu;//由于已经将student加上注解:@Component//作用是将此bean放入spring容器,所以可以进行自动注入
@Test
public void contextLoads() {
System.out.println(stu.toString());
}
}
1
2
3
4
5
6
7
8
9
10
11
4.yml通过@ConfigurationProperties 和@Value方式注入值
@ConfigurationProperties:是为了能够让配置文件识别这个对象
@Value:是给单个属性赋值 @Value用法:
public class StudentPo {
@Value("zx")//加上这条注解之后name的值就变为zx
private String name;
@Value("23")//age就变为23
private int age;
}
1
2
3
4
5
6
#
@ConfigurationProperties
@Value
注值
批量注入
单个
spEL
不支持
支持
JSR303
支持
不支持
注入复杂类型
支持
不支持
复杂类型:除了(8个基本类型,String,Date类型以外的都是复杂类型)
下面重点讲解一下JSR303校验的用法:
@Component//作用是将此bean放入spring容器
@ConfigurationProperties(prefix="student")//作用是将StudentPo能够被yml文件识别,并能对其进行属性的注入
@Validated//开启jsr303数据校验
public class StudentPo {
@Email
private String emial
}
1
2
3
4
5
6
7
通过注解@PropertySource来加载不是默认配置文件的文件,注:默认配置文件只有两种:
application.properties
application.yml
除此之外都不是默认配置文件 具体如何使用@PropertySource,参考下面代码
先看看conf.properties
student.age=66
1
再接着看如何使用:
@Component//作用是将此bean放入spring容器
@ConfigurationProperties(prefix="student")//作用是将StudentPo能够被yml文件识别,并能对其进行属性的注入
@Validated//开启jsr303数据校验
@PropertySource(value= {"classpath:conf.properties"})//作用是引入配置文件
public class StudentPo {
private int age
}
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
Insert title here
Hello ${requestScope.name} Welcome to Index.jsp
1
2
3
4
5
6
7
8
9
10
11
12
Controller:
@Controller
public class WebController {
@RequestMapping("/welcome")
public String welcome(Mapmap) {
map.put("name", "朱旭");
return "index";
}}
在网上无意中看到淘宝提交的hotspot patch,共四个,有意思,记录一下。
7050685:jsdbproc64.sh has a typo in the package name
7058036:FieldsAllocationStyle=2 does not work in 32-bit VM
7060619:C1 should respect inline and
CREATE TABLE sessions (
id CHAR(32) NOT NULL,
data TEXT,
last_accessed TIMESTAMP NOT NULL,
PRIMARY KEY (id)
);
<?php
/**
* Created by PhpStorm.
* User: michaeldu
* Date
public Vector<CartProduct> delCart(Vector<CartProduct> cart, String id) {
for (int i = 0; i < cart.size(); i++) {
if (cart.get(i).getId().equals(id)) {
cart.remove(i);
问题是首页在火狐、谷歌、所有IE中正常显示,列表页的页面在火狐谷歌中正常,在IE6、7、8中都不中,觉得可能那个地方设置的让IE系列都不认识,仔细查看后发现,列表页中没写HTML模板部分没有添加DTD定义,就是<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3
com.jcraft.jsch.JSchException: Auth cancel
at com.jcraft.jsch.Session.connect(Session.java:460)
at com.jcraft.jsch.Session.connect(Session.java:154)
at cn.vivame.util.ftp.SftpServerAccess.connec
centos p安装
yum -y install tree
mac os安装
brew install tree
首先来看tree的用法
tree 中文解释:tree
功能说明:以树状图列出目录的内容。
语 法:tree [-aACdDfFgilnNpqstux][-I <范本样式>][-P <范本样式
一. 实体类简述
实体类其实就是俗称的POJO,这种类一般不实现特殊框架下的接口,在程序中仅作为数据容器用来持久化存储数据用的
POJO(Plain Old Java Objects)简单的Java对象
它的一般格式就是
public class A{
private String id;
public Str