Spring Notes

Submitted by code_admin on Wed, 11/28/2018 - 15:16

https://start.spring.io/
See https://code.metcarob.com/node/240
Also https://github.com/rmetcalf9/SpringPlay

Examples

Rest service consuming and providing. Tests, property injection - https://github.com/rmetcalf9/SpringPlay/tree/master/spring_shopping_bas…

Other

@ContextConfiguration(classes = {FanceyWriter.class, HelloWorld.class, etc})

@MockBean
TextWriter fancy;

IN CLASS

@Autowired
private MockMvc mockMvc;

@Test
public void test() throws Exception {

//mockito
when(fancy.writeText("aa")).thenReturn("aa Mock");

MvcResult result = this.mockMvc.perform(get("/"))
.andDo(print())
.andExpect(status().isOk())
.andReturn();
}

POC Stages:

  • DONE Simple Hello World Rest service
  • DONE Tested hello world rest service
  • DONE Model
  • Hello World service calling another service
  • Injecting APIKEY configuration

Tags

RJM Article Type
Work Notes