Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 826 Bytes

README.md

File metadata and controls

33 lines (25 loc) · 826 Bytes

jsonview-spring-boot-starter

1. 引入

<dependency>
  <groupId>com.github.developframework</groupId>
  <artifactId>jsonview-spring-boot-starter</artifactId>
  <version>1.1.2</version>
</dependency>

2. 配置

使用@EnableJsonview注解开启Jsonview功能

@SpringBootApplication
@EnableJsonview
public class MyApplication {
	
  	public static void main(String[] args) {
        SpringApplication.run(MyApplication.class, args);
    }
}

使用注解@EnableJsonview自动化完成对JsonviewResponseReturnValueHandlerDataModelReturnValueHandler的注册。在spring-boot的application.properties总配置项中可以使用

jsonview.locations=classpath*:jsonview/*.xml #指定扫描路径
jsonview.objectmapper.usedefault=true #采用默认的ObjectMapper对象