These slides are up on GitHub
jeffsheets.github.io/BuzzworthyJava2015Also a printable version | Open Printable PDF
@RestController
class GBR {
@RequestMapping("/")
String gbr() {
"Go Big Red! #Nebrasketball"
}
}
@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
public interface AttendeeRepository extends JpaRepository {
List findByOrderByNameDesc();
List findByNameOrderByNameAsc(String name);
List findByOrderByNameAsc();
}
@RepositoryRestResource(collectionResourceRel = "people", path = "people")
public interface PersonRepository extends PagingAndSortingRepository {
List findByLastName(@Param("name") String name);
}
class AccountControllerTest extends Specification {
def accountController = new AccountController()
MockMvc mockMvc = standaloneSetup(accountController).build()
def "getAccount test hits the URL and parses JSON output"() {
when: 'rest account url is hit'
def response = mockMvc.perform(get('/rest/account')).andReturn().response
def content = new JsonSlurper().parseText(response.contentAsString)
then: 'securityService correctly returned account in JSON'
response.status == OK.value()
//Can test the whole content string that is returned
response.contentAsString == '{"username":"spockUser"}'
//Or can use the JsonSlurper version to test the JSON as object
content.username == 'spockUser'
}
}
npm install -g yo
npm install -g generator-jhipster
yo jhipster
gradle bootRun
grunt server
yo jhipster:entity location
//city, state, one-to-many attendee
yo jhipster:entity attendee
//name, previousAttendee, speaker, notes, many-to-one location
mvn -Pprod package
java -jar jhipster-0.0.1-SNAPSHOT.war --spring.profiles.active=prod