Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouwentong1993 committed Aug 21, 2023
1 parent 44eef2f commit caefa60
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/main/java/com/wentong/ladder/config/WebConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.wentong.ladder.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig {

@Bean
WebMvcConfigurer webMvcConfigurer() {
return new WebMvcConfigurer() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/form/submit").allowedOrigins("http://localhost:8081").allowedMethods("POST");
}
};
}

}

18 changes: 18 additions & 0 deletions src/main/java/com/wentong/ladder/controller/FormController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.wentong.ladder.controller;

import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/form")
public class FormController {

@PostMapping("/submit")
public String submit(@RequestBody Map map) {
// TODO
System.out.println(map);
return "success";
}

}
4 changes: 3 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mybatis-plus.configuration.auto-mapping-behavior=full
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
mybatis-plus.configuration.use-generated-keys=true
mybatis-plus.configuration.mapper-locations=classpath*:mapper/**/*Mapper.xml
mybatis-plus.configuration.type-aliases-package=top.yumuing.community.entity
mybatis-plus.configuration.type-alia---ses-package=top.yumuing.community.entity

ladder.ladderScanBasePackage=com.wentong.ladder
ladder.ladderFunctionScanBasePackage=com.wentong.ladder
Expand All @@ -19,3 +19,5 @@ spring.data.redis.port=6379
spring.data.redis.password=
spring.data.redis.database=0
spring.data.redis.timeout=10000


0 comments on commit caefa60

Please sign in to comment.