This commit is contained in:
Anton Romanov 2025-02-14 15:09:44 +04:00
parent 68da6681f5
commit 9ee62e2aa5
8 changed files with 22 additions and 74 deletions

View File

@ -1,51 +1,25 @@
buildscript { plugins {
ext { id 'java'
versionSpringBoot = '2.3.9.RELEASE' id 'org.springframework.boot' version '3.4.2'
id 'io.spring.dependency-management' version '1.1.7'
}
group = 'ru.ulstu'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
} }
repositories { repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath group: 'org.springframework.boot', name: 'spring-boot-gradle-plugin', version: versionSpringBoot
}
}
group 'ru.ulstu'
version '0.0.1'
apply plugin: 'java'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
sourceCompatibility = 11
targetCompatibility = 11
jar {
archiveBaseName = 'fuzzy-controller'
}
compileJava {
options.encoding = "UTF-8"
}
repositories {
mavenLocal()
mavenCentral()
maven { maven {
url="https://repository.ow2.org/nexus/content/repositories/public" url = uri("http://repo.athene.tech/repository/maven-central/")
allowInsecureProtocol(true)
} }
} }
configurations {
implementation.exclude module: "spring-boot-starter-tomcat"
implementation.exclude module: "follow-redirects"
implementation.exclude module: "is-buffer"
}
dependencies { dependencies {
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web'
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jetty' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jetty'
@ -61,7 +35,7 @@ dependencies {
implementation group: 'commons-io', name: 'commons-io', version: '2.6' implementation group: 'commons-io', name: 'commons-io', version: '2.6'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0' implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.8.4'
implementation group: 'com.ibm.icu', name: 'icu4j', version: '63.1' implementation group: 'com.ibm.icu', name: 'icu4j', version: '63.1'
implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '5.9.0.202009080501-r' implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '5.9.0.202009080501-r'

Binary file not shown.

View File

@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -1,5 +1,6 @@
package ru.ulstu.fc.config; package ru.ulstu.fc.config;
import io.swagger.v3.oas.annotations.Hidden;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -7,25 +8,13 @@ import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.NoHandlerFoundException; import org.springframework.web.servlet.NoHandlerFoundException;
import springfox.documentation.annotations.ApiIgnore;
@ControllerAdvice @ControllerAdvice
@ApiIgnore @Hidden
class GlobalDefaultExceptionHandler { class GlobalDefaultExceptionHandler {
private final static Logger LOG = LoggerFactory.getLogger(GlobalDefaultExceptionHandler.class); private final static Logger LOG = LoggerFactory.getLogger(GlobalDefaultExceptionHandler.class);
public static final String DEFAULT_ERROR_VIEW = "error"; public static final String DEFAULT_ERROR_VIEW = "error";
// @ExceptionHandler(value = Exception.class)
// public ModelAndView defaultErrorHandler(HttpServletRequest req, Exception e) {
// LOG.warn(e.getMessage());
// ModelAndView mav = new ModelAndView();
// mav.addObject("exception", e);
// mav.addObject("url", req.getRequestURL());
// mav.setViewName(DEFAULT_ERROR_VIEW);
// return mav;
// }
@ExceptionHandler(NoHandlerFoundException.class) @ExceptionHandler(NoHandlerFoundException.class)
@ResponseStatus(HttpStatus.NOT_FOUND) @ResponseStatus(HttpStatus.NOT_FOUND)
public String handle(NoHandlerFoundException ex) { public String handle(NoHandlerFoundException ex) {

View File

@ -14,16 +14,9 @@ import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.CookieLocaleResolver; import org.springframework.web.servlet.i18n.CookieLocaleResolver;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
@Configuration @Configuration
public class MvcConfiguration implements WebMvcConfigurer { public class MvcConfiguration implements WebMvcConfigurer {
// @Override
// public void addViewControllers(ViewControllerRegistry registry) {
// registry.addViewController("/index");
// }
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
@ -44,14 +37,6 @@ public class MvcConfiguration implements WebMvcConfigurer {
return localeInterceptor; return localeInterceptor;
} }
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("ru.ulstu"))
.build();
}
@Override @Override
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(localeInterceptor()); registry.addInterceptor(localeInterceptor());

View File

@ -1,9 +1,9 @@
package ru.ulstu.fc.config; package ru.ulstu.fc.config;
import nz.net.ultraq.thymeleaf.LayoutDialect; import nz.net.ultraq.thymeleaf.layoutdialect.LayoutDialect;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.thymeleaf.spring5.SpringTemplateEngine; import org.thymeleaf.spring6.SpringTemplateEngine;
import org.thymeleaf.templateresolver.ITemplateResolver; import org.thymeleaf.templateresolver.ITemplateResolver;
@Configuration @Configuration

View File

@ -1,5 +1,6 @@
package ru.ulstu.fc.rule.controller; package ru.ulstu.fc.rule.controller;
import io.swagger.v3.oas.annotations.Hidden;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -9,14 +10,13 @@ import org.springframework.web.bind.annotation.RequestMethod;
import ru.ulstu.fc.rule.model.Antecedent; import ru.ulstu.fc.rule.model.Antecedent;
import ru.ulstu.fc.rule.model.InferenceForm; import ru.ulstu.fc.rule.model.InferenceForm;
import ru.ulstu.fc.rule.service.FuzzyInferenceService; import ru.ulstu.fc.rule.service.FuzzyInferenceService;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Controller @Controller
@ApiIgnore @Hidden
public class InferenceMvcController { public class InferenceMvcController {
private final FuzzyInferenceService fuzzyInferenceService; private final FuzzyInferenceService fuzzyInferenceService;

View File

@ -17,6 +17,4 @@ spring.datasource.password=password
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true spring.h2.console.enabled=true
spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.ddl-auto=update
# swagger-ui custom path
springdoc.swagger-ui.path=/swagger-ui.html