以下内容部分来自小马哥的 《springboot 编程思想》

基础 springboot 项目

springboot 自动装配

  • maven 依赖
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                <version>2.1.5.RELEASE</version>
            </dependency>
  • 启动

springboot 自动装配

项目会使用默认的8080端口

@SpringBootApplication 注解

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan(
    excludeFilters = {@Filter(
    type = FilterType.CUSTOM,
    classes = {TypeExcludeFilter.class}
), @Filter(
    type = FilterType.CUSTOM,
    classes = {AutoConfigurationExcludeFilter.class}
)}
)
public @interface SpringBootApplication {
...
  • 替换@SpringBootApplication
    springboot 自动装配

启动成功!

相关文章:

  • 2021-06-25
  • 2021-07-21
  • 2021-07-12
  • 2022-01-24
  • 2021-12-13
猜你喜欢
  • 2021-07-04
  • 2022-01-06
  • 2021-08-08
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
相关资源
相似解决方案