3 回答
TA贡献1803条经验 获得超3个赞
1、要将$http中的Content-Type设置为application/x-www-form-urlencoded因为目前的浏览器只支持这种类型的跨域 2、需要在Application同级目录下写一个配置类,在里面配置一个返回类型为WebMvcConfigurerAdapter的Bean,用registry.addMapping("/*")设置拦截的范围"/*"代表拦截所有请求。
TA贡献1891条经验 获得超3个赞
<
bean
id
=
"sqlSessionFactory"
class
=
"org.mybatis.spring.SqlSessionFactoryBean"
depends-on
=
"flyway"
>
<
property
name
=
"dataSource"
ref
=
"dataSource"
/>
<!-- 我是假定你的文件放在src/main/resource/com/lt-->
<
property
name
=
"mapperLocations"
value
=
"classpath:/com/lt/*.xml"
/>
</
bean
>
<!-- mybatis:DAO映射 -->
<
bean
class
=
"org.mybatis.spring.mapper.MapperScannerConfigurer"
>
<
property
name
=
"basePackage"
value
=
"com.lt.mapper"
/>
<
property
name
=
"sqlSessionFactoryBeanName"
value
=
"sqlSessionFactory"
/>
</
bean
>
添加回答
举报