提交 5567cfce 编写于 作者: 梦境迷离's avatar 梦境迷离

gg

上级 5b5c5be5
......@@ -7,7 +7,8 @@ git pull origin master
./gradlew bootRepackage
nohup java -jar -Dspring.mail.username=568845948@qq.com \
nohup java -jar \
-Dserver.port=8989 -Dspring.mail.username=568845948@qq.com \
-Dspring.mail.password=aklbpawjeosybdfb \
-Dspring.datasource.username=root \
-Dspring.datasource.password= \
......
......@@ -17,16 +17,15 @@ import scala.beans.BeanProperty
@MapperScan(Array("io.github.dreamylost.repository"))
class ApplicationConfig
object Application extends SpringBootServletInitializer {
@BeanProperty
var applicationContext: ApplicationContext = _
def main(args: Array[String]): Unit =
applicationContext = SpringApplication.run(classOf[ApplicationConfig], args:_*)
applicationContext = SpringApplication.run(classOf[ApplicationConfig], args: _*)
override protected def configure(builder: SpringApplicationBuilder): SpringApplicationBuilder =
builder.sources(Application)
}
\ No newline at end of file
}
......@@ -3,8 +3,13 @@ package io.github.dreamylost.config
import com.fasterxml.jackson.databind.ObjectMapper
import io.github.dreamylost.util.Jackson
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.context.annotation.{ Bean, Configuration, Primary }
import org.springframework.web.servlet.config.annotation.{ InterceptorRegistry, ResourceHandlerRegistry, ViewControllerRegistry, WebMvcConfigurerAdapter }
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Primary
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
import org.springframework.web.servlet.config.annotation.CorsRegistry
/** SpringMVC配置
......@@ -65,14 +70,16 @@ class SpringMVCConfig extends WebMvcConfigurerAdapter {
def jacksonObjectMapper(): ObjectMapper = {
Jackson.mapper
}
/**
* 允许跨域
/** 允许跨域
*/
override def addCorsMappings(registry: CorsRegistry): Unit = {
registry.addMapping("/**").allowedOrigins("*")
registry
.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "PUT", "OPTIONS", "DELETE", "PATCH")
.allowCredentials(true).maxAge(3600)
.allowCredentials(true)
.maxAge(3600)
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册