inurl-spring-ext

inurl spring ext

License

License

GroupId

GroupId

org.inurl
ArtifactId

ArtifactId

inurl-spring-ext
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

inurl-spring-ext
inurl spring ext
Project URL

Project URL

https://github.com/raylax/spring-ext
Source Code Management

Source Code Management

https://github.com/raylax/spring-ext.git

Download inurl-spring-ext

How to add to project

<!-- https://jarcasting.com/artifacts/org.inurl/inurl-spring-ext/ -->
<dependency>
    <groupId>org.inurl</groupId>
    <artifactId>inurl-spring-ext</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.inurl/inurl-spring-ext/
implementation 'org.inurl:inurl-spring-ext:1.0.0'
// https://jarcasting.com/artifacts/org.inurl/inurl-spring-ext/
implementation ("org.inurl:inurl-spring-ext:1.0.0")
'org.inurl:inurl-spring-ext:jar:1.0.0'
<dependency org="org.inurl" name="inurl-spring-ext" rev="1.0.0">
  <artifact name="inurl-spring-ext" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.inurl', module='inurl-spring-ext', version='1.0.0')
)
libraryDependencies += "org.inurl" % "inurl-spring-ext" % "1.0.0"
[org.inurl/inurl-spring-ext "1.0.0"]

Dependencies

provided (2)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 3.1.0
org.springframework : spring-webmvc jar

test (5)

Group / Artifact Type Version
org.springframework.boot : spring-boot-starter-test jar 2.0.9.RELEASE
com.google.guava : guava jar 29.0-jre
org.assertj : assertj-core jar 3.9.1
org.junit.jupiter : junit-jupiter-api jar 5.1.1
org.junit.jupiter : junit-jupiter-engine jar 5.1.1

Project Modules

There are no modules declared in this project.

Spring 拓展

Build Status codecov maven license

引入依赖

<!-- https://mvnrepository.com/artifact/org.inurl/inurl-spring-ext -->
<dependency>
    <groupId>org.inurl</groupId>
    <artifactId>inurl-spring-ext</artifactId>
    <version>1.0.0</version>
</dependency>

数据绑定

支持url参数使用model绑定进行重映射

  • org.inurl.spring.ext.bind.ModelRequestParamProcessor
  • org.inurl.spring.ext.bind.ModelRequestParam

参考https://stackoverflow.com/a/16520399

// WebMvcConfiguration.java
@Configuration
public class WebMvcConfiguration {

    @Bean
    public ModelRequestParamProcessor modelRequestParamProcessor() {
        return new ModelRequestParamProcessor();
    }
    
}
// TestModel.java
public class TestModel {
    private String a;
    @ModelRequestParam("b")
    private String c;
    @ModelRequestParam(name = "y")
    private int z;
    //... setter and getter
}
// TestController.java
@RestController
public class TestController {
    @GetMapping("/test")
    public TestModel test(TestModel param) {
        return param;
    }
}
// GET /test?a=1&b=2&y=3 
// OUTPUT => { "a": "1", "c": "2", "z": 3 }

Versions

Version
1.0.0