day04 注解方式开发bean
2019-03-05 本文已影响0人
老婆日向雏田
1.Hello的例子改成注解的方法实现
Hello类,采用@Component注解

HelloApp类,采用@ComponentScan注解

2.Student和phone的例子改成注解的方法实现
Lombok插件的使用
(1)Settings--plugins---Lombol----install---restart
(2)在pom.xml中添加依赖

使用@Data注解,简化POJO类,不用再写那些构造方法,getter,setter,toString,专注定义属性即可
Student类

StudentApp类

Phone类

运行结果
