基于spring活动配置文件,我限制了bean的创建。因此,这些无法在生产环境中访问t。
<beans profile="test">
<bean id="testSwaggerConfig" class="com.example.rest.config.SwaggerConfig" />
</beans>类似地,如何基于spring配置文件来限制资源。因此,在访问html页面时,我应该得到404。
<mvc:resources mapping="/rest/*.html" location="/rest-doc/" />我从环境变量-Dspring.profiles.active传递活动配置文件(可能对某人有用)
发布于 2015-03-06 08:53:28
您可以为每个配置文件定义参数bean,如下所示
<bean name="profileParam" class="java.lang.String">
<constructor-arg value="/rest/*.html" />
</bean>并将所需的映射放置在param中,然后使用配置文件中的param,如下所示
<mvc:resources mapping="#{profileParam}" location="/rest-doc/" />因此,对于不同的配置文件,可以访问不同的映射。
https://stackoverflow.com/questions/28894760
复制相似问题