今天在试 spring boot 的时候测试,@controller 要配合spring boot的模板一起使用,但是项目创建好返现,报错 org.xml.sax.SAXParseException: 元素类型 “meta” 必须由匹配的结束标记 “” 终止。
 
这个是html文件报错呀,果然,在页面中发现,meta 没有终止,这个希望大家注意,这个是系统创建的,所以,要注意  
 
大家填一下 反斜杠就好了
 
项目路径:  
 
server:
  port: 
8080
girl:
  cupSize: B
  age: 
19 
这个结合配置文件信息中的 girl
 
@Component
@ConfigurationProperties(prefix = 
"girl")
public class GirlProperties {
    private String cupSize;
    
private Integer age;
    
public String 
getCupSize() {
        
return cupSize;
    }
    
public void setCupSize(String cupSize) {
        
this.cupSize = cupSize;
    }
    
public Integer 
getAge() {
        
return age;
    }
    
public void setAge(Integer age) {
        
this.age = age;
    }
} 
这是是实现层,如果需要打印配置文件里面的信息,需要把注解去掉就可以了,我这个是为了测试,@controller层结合模板
 
@Controller
public class TestPropertiesController {
    @Autowired
    private GirlProperties girlProperties;
    
@RequestMapping(value = 
"/hello",method = RequestMethod.GET)
    
public String 
Test(){
        
        
return "index";
    }
}