我有一个 WebSecurityConfigurerAdapter 的自定义实现,我在其中覆盖了 config() 方法以使用匹配器授权请求。
我需要创建使用模拟 mvc 向我的控制器发送请求的单元测试,以确保它们被正确阻止。但是当我运行测试时,它们不会加载我对 WebSecurityConfigurerAdapter 的实现。
从我的SecurityConfigSso.class覆盖 WebSecurityConfigurerAdapter::configure() 方法:
@Override
protected void configure( HttpSecurity http ) throws Exception {
http.authorizeRequests()
.antMatchers( "/img/**", "lib/**", "/api/event**", "/api/event/**","/login/cas**" ).permitAll()
.antMatchers(HttpMethod.GET, "/**").hasAnyAuthority(AvailableRoles.ANY)
.antMatchers(HttpMethod.POST, "/**").hasAnyAuthority(AvailableRoles.ADMIN, AvailableRoles.GIS_ANALYST)
.antMatchers(HttpMethod.PUT, "/**").hasAnyAuthority(AvailableRoles.ADMIN, AvailableRoles.GIS_ANALYST)
.antMatchers(HttpMethod.DELETE, "/**").hasAnyAuthority(AvailableRoles.ADMIN, AvailableRoles.GIS_ANALYST)
.anyRequest().authenticated();
}
Run Code Online (Sandbox Code Playgroud)
这是我的单元测试:
@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = { SecurityConfigSso.class })
public class SecurityTestControllerTests {
private final String SECURITY_URL = "/security";
private MockMvc mockMvc;
@Autowired
private WebApplicationContext context;
@Before
public void init() {
Assert.assertNotNull(context);
mockMvc = MockMvcBuilders.webAppContextSetup(context).build();
} …Run Code Online (Sandbox Code Playgroud) 有谁知道为什么当我在命令提示符中键入以下命令时,它没有打开预期的程序,而是打开另一个命令提示符窗口?如果我使用命令创建批处理文件也是如此。
start "C:\Program Files\BrokerLink AutoPrint\BrokerLinkAutoPrint.exe"
Run Code Online (Sandbox Code Playgroud) 当将许多特征足迹向量加载到地图上时,openlayers 地图和 Web 应用程序变得无响应。有什么方法可以提高具有许多向量的 openlayers 地图的性能吗?
我们希望能够一次在地图上支持至少 1000 个向量。
我们正在使用 openlayers 4。
据我所知,OpenLayers 3+ 使用 HTML5 画布来渲染图像和矢量。我见过画布被用来制作视频游戏和其他高性能图形应用程序。我不明白为什么它会导致 OpenLayers 出现这种无响应的问题。
编辑:当我说“向量”时,我的意思是方形多边形。此应用程序将在具有平均计算能力的桌面上运行。
command ×1
geospatial ×1
gis ×1
java ×1
javascript ×1
openlayers ×1
openlayers-3 ×1
prompt ×1
spring ×1
unit-testing ×1