Skip to content

Instantly share code, notes, and snippets.

View tyama's full-sized avatar
💤

Tsuyoshi Yamamoto tyama

💤
  • newcast inc.
  • Tajimi,Japan
  • 10:43 (UTC +09:00)
View GitHub Profile
apply plugin: 'java'
apply plugin: 'spring-boot'
apply plugin: 'idea'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath('org.springframework.boot:spring-boot-gradle-plugin:1+')
@tyama
tyama / boot-gorm-hibernate4.groovy
Last active August 29, 2015 14:18 — forked from graemerocher/boot-gorm-hibernate4.groovy
Using GORM for Hibernate 4 in Spring Boot
@Grab("org.grails:gorm-hibernate4-spring-boot:1.1.0.RELEASE")
@Grab("com.h2database:h2:1.3.173")
import grails.persistence.*
import org.springframework.http.*
import static org.springframework.web.bind.annotation.RequestMethod.*
// curl -XPOST http://localhost:8080/person/add -F 'firstName=Tony'
// curl -XGET 'http://localhost:8080/person/greet?firstName=Tony'
@RestController
class GreetingController {
@tyama
tyama / script-gorm-hibernate4.groovy
Created April 8, 2015 08:42
Using GORM for Hibernate4 in a Groovy Script
@Grab("org.grails:grails-datastore-gorm-hibernate4:3.1.4.RELEASE")
@Grab("com.h2database:h2:1.3.173")
@Grab("org.grails:grails-spring:2.5.0")
@Grab('org.slf4j:slf4j-simple:1.7.12')
import grails.orm.bootstrap.*
import grails.persistence.*
import org.springframework.jdbc.datasource.DriverManagerDataSource
import org.h2.Driver
def init = new HibernateDatastoreSpringInitializer(Person)
package app;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.boot.SpringApplication;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.http.server.ServletServerHttpResponse;
import org.springframework.web.servlet.ModelAndView;
//add this to your spring security config.
grails.plugin.springsecurity.rejectIfNoRule = false
grails.plugin.springsecurity.fii.rejectPublicInvocations = false
grails.plugin.springsecurity.ipRestrictions = [
'/shutdown':['127.0.0.1']
]
buildscript {
repositories {
mavenLocal()
maven { url "https://repo.grails.org/grails/core" }
}
dependencies {
classpath "org.grails:grails-gradle-plugin:$grailsVersion"
//classpath "org.grails.plugins:hibernate5:${gormVersion-".RELEASE"}"
//classpath "com.bertramlabs.plugins:asset-pipeline-gradle:2.14.2"
}