我根据 spring 活动配置文件限制了 bean 的创建。因此,这些在生产环境中无法访问。
<beans profile="test">
<bean id="testSwaggerConfig" class="com.example.rest.config.SwaggerConfig" />
</beans>
同样,如何根据 spring active profiles 限制资源。因此,在访问 html 页面时,我应该得到404。
<mvc:resources mapping="/rest/*.html" location="/rest-doc/" />
我正在从环境变量传递活动配置文件-Dspring.profiles.active
(可能此信息对某人有用)