1.@configuration @EnabeAutoConfiguration @ComponentScan
<strong>package com.example.myproject;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.EnableAutoConfiguration;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.annotation.Configuration;@Configuration@EnableAutoConfiguration@ComponentScanpublic class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); }}</strong>
2.@SpringBootApplication
<strong>package com.my.data.cache;import org.springframework.boot.CommandLineRunner;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;/** * 项目启动器 * @author wangbowen * */@SpringBootApplication//必须标注该注解才能扫描程序里面的注解组件public class SimpleApplication implements CommandLineRunner{ @Override public void run(String... args) throws Exception { System.out.println("hello!Spring Boot"); } public static void main(String[] args) { SpringApplication.run(SimpleApplication.class, args); }}</strong>
再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow