小编AVP*_*AVP的帖子

使用Grunt.js对partials进行静态HTML编译

我一直在寻找能让我使用Grunt预编译静态网站的东西.它需要有部分内容,因此我可以在页面中包含类似公共页眉/页脚的内容.

到目前为止,我只是真正找到了Jade,它有一个grunt插件,而这个 Grunt插件可以将Dust.js模板编译为静态HTML.我不太喜欢Jade的语法,而Grunt的Dust插件并不理想.

是否有任何静态HTML模板语言与Grunt/Gulp支持不会偏离常规HTML,并且仍处于活动状态?

html web dust.js pug

18
推荐指数
1
解决办法
9194
查看次数

使用MockMVC测试Spring MVC路由器

我正在尝试使用Spring测试来测试我的Spring MVC webapp.它使用springmvc-router进行路由,这似乎打破了测试,当我使用@RequestMapping而不是我的routes.conf文件时,它可以正常工作.

我有一个.jsp名为的文件valid.jsp,当我从Jetty运行开发站点时,它显示正常.控制器是:

@Controller
@EnableWebMvc
public class AuthController {
  public String valid() {
    return "valid";
  }
}
Run Code Online (Sandbox Code Playgroud)

我的routes.conf文件映射GET /valid authController.valid.

现在,我的测试仪看起来像

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"/test-context.xml",
    "/spring/spring-security.xml",
    "file:src/main/webapp/WEB-INF/mvc-config.xml"})
@WebAppConfiguration
@Import(RouteConfig.class)
public class AuthControllerTest {
  private MockMvc mockMvc;

  @Autowired
  private WebApplicationContext webApplicationContext;

  @Autowired
  private AuthenticationManager authenticationManager;

  @Before
  public void init() {
    MockitoAnnotations.initMocks(this);
    mockMvc =
        MockMvcBuilders.webAppContextSetup(webApplicationContext).dispatchOptions(true).build();
  }

  @Test
  public void testValid() throws Exception {
    mockMvc.perform(get("/validation-success"))
        .andDo(print())
        .andExpect(status().isOk());
  } …
Run Code Online (Sandbox Code Playgroud)

java junit spring-mvc spring-mvc-test

9
推荐指数
1
解决办法
2万
查看次数

标签 统计

dust.js ×1

html ×1

java ×1

junit ×1

pug ×1

spring-mvc ×1

spring-mvc-test ×1

web ×1