net.optionfactory:defiance

Enable Spring Web MVC with public fields binding support

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

net.optionfactory
Идентификатор

Идентификатор

defiance
Последняя версия

Последняя версия

2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

net.optionfactory:defiance
Enable Spring Web MVC with public fields binding support
Ссылка на сайт

Ссылка на сайт

https://github.com/optionfactory/defiance
Система контроля версий

Система контроля версий

https://github.com/optionfactory/defiance

Скачать defiance

Как подключить последнюю версию

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

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.springframework : spring-webmvc jar 5.1.5.RELEASE

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

Defiance

Replace @EnableWebMvc annotation with @EnableWebMvcWithDirectFieldAccess to activate direct field access in Spring WebDataBinder.

This allows binding between requests and DTOs with public fields and without getters and setters.

NOTE: do not use both @EnableWebMvc and @EnableWebMvcWithDirectFieldAccess on the same context.

Example

@Configuration
//@EnableWebMcv
@EnableWebMvcWithDirectFieldAccess
public class ApiConfig extends WebMvcConfigurerAdapter {

    // configuration

}

public class WebApp implements WebApplicationInitializer {

    @Override
    public void onStartup(ServletContext sc) throws ServletException {

        final AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
        rootContext.register(MainConfig.class);
        sc.addListener(new ContextLoaderListener(rootContext));

        final AnnotationConfigWebApplicationContext apiContext = new AnnotationConfigWebApplicationContext();
        apiContext.setParent(rootContext);
        apiContext.setDisplayName("apiContext");
        apiContext.register(ApiConfig.class);
        final ServletRegistration.Dynamic api = sc.addServlet("api", new DispatcherServlet(apiContext));
        api.setLoadOnStartup(1);
        api.addMapping(... mappings ...);
    }
}

Maven artifact

<dependency>
  <groupId>net.optionfactory</groupId>
  <artifactId>defiance</artifactId>
  <version>1.0</version>
</dependency>
net.optionfactory

OptionFactory

Версии библиотеки

Версия
2.0
1.0