我试图允许某个特定域名通过iframe访问我的网站
Header set X-Frame-Options ALLOW-FROM https://www.that-site.com
Run Code Online (Sandbox Code Playgroud)
我知道这可以通过将上面的行添加到Apache服务器的配置来完成.
这里有两个问题.
1)应该添加哪个配置文件?apache在Unix和windows上运行,如果不是同一个文件
2)在启用all-from时,我仍然希望能够从我自己的域运行一些iframe.我可以在allow-from之后添加以下行吗?
Header set X-Frame-Options SAMEORIGIN
Run Code Online (Sandbox Code Playgroud)
或者我应该在all-from中添加我自己的域名,即
Header set X-Frame-Options ALLOW-FROM https://www.that-site.com, http://www.my-own-domain.com
Run Code Online (Sandbox Code Playgroud)
真的需要解决这个问题.提前致谢
为了避免 Spring 上下文一次又一次地重新加载,我已将带@MockBean注释的注入移至父类,如下所示。
@SpringBootTest
.......
public abstract BaseTest {
@MockBean
protected OneService oneService;
Run Code Online (Sandbox Code Playgroud)
这为需要模拟的测试类提供服务OneService。但是,对于我也想从 扩展的测试BaseTest,但注入真实的OneServicevia@Autowired将不起作用,因为它将继承来自 的模拟注入BaseTest。
public AnotherTest extends BaseTest {
@Autowired
protected OneService oneService;
Run Code Online (Sandbox Code Playgroud)
即使我使用了@Autowired注释,该oneService字段也将是从 继承的模拟实例BaseTest。
有没有办法可以强制注入使用自动装配?
我是JBoss AS 7的新手.我试图在JBoss AS 7上部署我的war文件,这似乎工作正常.我的问题是我可以看到部署的内容.
我希望它就像Tomcat一样,它应该有一个探索过的war文件夹,在哪里可以保存已部署的内容.JBoss AS 7有这样的东西吗?
当我通过intellij启动我的spring启动应用程序时,下面的类正确初始化并且可以看到日志.但如果我从构建中再次运行jar,MyCurrentTraceContext似乎没有初始化,我也看不到输出中的日志.我确实需要这个类和我的定制逻辑来运行一些参数到MDC.有什么建议?
@Configuration
@ConditionalOnProperty(value="spring.sleuth.enabled", matchIfMissing=true)
@AutoConfigureBefore(TraceAutoConfiguration.class)
public class MyLogConfiguration extends SleuthLogAutoConfiguration {
private static final Logger LOGGER = (Logger) LoggerFactory.getLogger(WtrLogConfiguration.class);
@Configuration
@ConditionalOnClass(MDC.class)
@EnableConfigurationProperties(SleuthSlf4jProperties.class)
protected static class MySlf4jConfiguration extends Slf4jConfiguration {
@Bean
@ConditionalOnProperty(value = "spring.sleuth.log.slf4j.enabled", matchIfMissing = true)
@ConditionalOnMissingBean
@Override
public CurrentTraceContext slf4jSpanLogger() {
LOGGER.info("************ OVER WRITTING WTIH WtrCurrentTraceContext*******");
return new MyCurrentTraceContext(Slf4jCurrentTraceContext.create());
}
}
}
Run Code Online (Sandbox Code Playgroud) spring-boot ×2
apache ×1
clickjacking ×1
java ×1
jboss ×1
mdc ×1
mockito ×1
spring ×1
spring-test ×1