Skip to content

Commit

Permalink
fix, update
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Nov 27, 2023
1 parent 8ff3bbc commit 534e2ad
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 9 deletions.
13 changes: 13 additions & 0 deletions ShoppingCart/Backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@
<version>2.9.2</version>
</dependency>

<!-- swagger -->
<!-- <dependency>-->
<!-- <groupId>org.springdoc</groupId>-->
<!-- <artifactId>springdoc-openapi-ui</artifactId>-->
<!-- <version>1.6.8</version>-->
<!-- </dependency>-->

<!-- <dependency>-->
<!-- <groupId>io.springfox</groupId>-->
<!-- <artifactId>springfox-swagger-ui</artifactId>-->
<!-- <version>2.9.2</version>-->
<!-- </dependency>-->

<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import springfox.documentation.builders.ApiInfoBuilder;
//import springfox.documentation.builders.PathSelectors;
//import springfox.documentation.builders.RequestHandlerSelectors;
//import springfox.documentation.service.ApiInfo;
//import springfox.documentation.service.Contact;
//import springfox.documentation.spi.DocumentationType;
//import springfox.documentation.spring.web.plugins.Docket;
//import springfox.documentation.swagger2.annotations.EnableSwagger2;
////import springfox.documentation.builders.ApiInfoBuilder;
////import springfox.documentation.builders.PathSelectors;
////import springfox.documentation.builders.RequestHandlerSelectors;
////import springfox.documentation.service.ApiInfo;
////import springfox.documentation.service.Contact;
////import springfox.documentation.spi.DocumentationType;
////import springfox.documentation.spring.web.plugins.Docket;
////import springfox.documentation.swagger2.annotations.EnableSwagger2;
//
//@Configuration
//@EnableSwagger2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.yen.ShoppingCart.config;

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 implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("*") // SpringBoot2.4.0 [allowedOriginPatterns]代替[allowedOrigins]
.allowedMethods("*")
.maxAge(3600)
.allowCredentials(true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//package com.yen.ShoppingCart.config;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.servlet.config.annotation.CorsRegistry;
//import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//
//@Configuration
//public class WebMvcConfig implements WebMvcConfigurer {
//
// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**")
// .allowedOrigins("*")
// .allowCredentials(true)
// .allowedHeaders("GET", "POST", "PUT", "DELETE", "OPTIONS")
// .allowedHeaders("Authorization", "Cache-Control", "Content-Type")
// .maxAge(3600);
// }
//
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
// registry.addResourceHandler("/swagger-ui/**")
// .addResourceLocations("classpath:/META-INF/resources/webjars/swagger-ui/4.10.3/");
// }
//
//}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ spring.datasource.password=
spring.jpa.hibernate.ddl-auto=update

#Api Context Path prefix
server.servlet.contextPath=/api
#server.servlet.contextPath=/api

spring.jpa.open-in-view=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
Expand All @@ -17,6 +17,8 @@ spring.jpa.properties.hibernate.globally_quoted_identifiers=true
STRIPE_PUBLIC_KEY = STRIPE PUBLIC KEY
STRIPE_SECRET_KEY = STRIPE SECRET KEY

#springdoc.enable-native-support=true

#For development use this url
#baseURL=http://localhost:8081/
#For production use this url
Expand Down

0 comments on commit 534e2ad

Please sign in to comment.