This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import grails.util.TypeConvertingMap | |
import grails.web.mapping.UrlMapping | |
import org.springframework.web.servlet.support.RequestContextUtils | |
class BootstrapTagLib { | |
static namespace = "boots" | |
Closure paginate = { Map attrsMap -> | |
TypeConvertingMap attrs = (TypeConvertingMap)attrsMap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
micronaut: | |
application: | |
name: example-micronaut-gorm | |
dataSource: | |
pooled: true | |
dbCreate: create-drop | |
url: jdbc:h2:mem:devDb | |
driverClassName: org.h2.Driver | |
username: sa | |
password: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example.micronaut.gorm.controller | |
import example.micronaut.gorm.domain.Person | |
import example.micronaut.gorm.service.PersonService | |
import io.micronaut.http.HttpResponse | |
import io.micronaut.http.annotation.Controller | |
import io.micronaut.http.annotation.Delete | |
import io.micronaut.http.annotation.Get | |
import io.micronaut.http.annotation.Post | |
import io.micronaut.http.annotation.Put |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example.micronaut.gorm | |
import example.micronaut.gorm.domain.Person | |
import example.micronaut.gorm.service.PersonService | |
import io.micronaut.context.event.StartupEvent | |
import io.micronaut.runtime.event.annotation.EventListener | |
import javax.inject.Singleton | |
@Singleton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example.micronaut.gorm.service | |
import example.micronaut.gorm.domain.Person | |
import grails.gorm.services.Service | |
import groovy.transform.CompileStatic | |
import javax.inject.Singleton | |
@Service(Person) | |
@CompileStatic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example.micronaut.gorm.service | |
import example.micronaut.gorm.domain.Person | |
import grails.gorm.services.Service | |
import groovy.transform.CompileStatic | |
import javax.inject.Singleton | |
@Service(Person) | |
@CompileStatic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install SDKMAN | |
curl -s "https://get.sdkman.io" | bash | |
source "$HOME/.sdkman/bin/sdkman-init.sh" | |
sdk version | |
2. Install Micronaut through sdk command |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package example.micronaut.gorm.domain | |
import grails.gorm.annotation.Entity | |
@Entity | |
class Person { | |
String name | |
String email |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plugins { | |
id "io.spring.dependency-management" version "1.0.6.RELEASE" | |
id "com.github.johnrengelman.shadow" version "4.0.2" | |
} | |
apply plugin:"application" | |
apply plugin:"groovy" | |
version "0.1" | |
group "example.micronaut.gorm" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DOMAIN CLASS (Post): | |
String timeDay | |
Date date | |
static mapping = { | |
timeDay formula: "FORMATDATETIME(date, 'yyyy-MM-dd')" // h2 sql | |
//timeMonth formula: "DATE_FORMAT(time, '%Y-%m-%d')" // mysql sql | |
} | |
CONTROLLER: | |
def c = Post.createCriteria() |
NewerOlder