Let's smush Ceylon, Spring Boot, and Thymeleaf together and see what happens!
Run the demo::run
function to fire up a server on localhost:8080
and experiment with the simple
CRUD webapp. Log in as admin1
or admin2
to get elevated privileges or anybody between user1
and user5
to get normal privileges.
demo.domain::Product
is! Since Ceylon takes care of the getters for us, we
can use direct field access when loading objects from the database and we're good to go.demo.services.impl::CrudServiceImpl.repository
with formal
, we enforce the
contract that each class in demo.services.impl
must specify which repository interface it's
going to use while also being able to provide default implementations of some common tasks.default
, we can use Ceylon List
s, Map
s, and Set
s, in many-to-many fields,
etc.variable
annotations and give up
immutability.List
, Map
, and Set
, not {T*}
, MutableSet<T>
, etc.See .ceylon/config
for important configuration options, notably:
You can find the Thymeleaf templates in the resource/demo/ROOT/templates/fragments
directory.
They use an unusual, inside-out layout pattern I like, where, instead of having to keep the page
structure consistent between templates, having to remember to include the header and footer
fragments, etc., templates pass themselves to the Layout fragment, which turns around and inserts
the content where it needs to go. The Layout.js
script handles jumping through the right hoops to
keep such templates looking natural. If you're using Chrome, please see the note in that file,
because you'll need a certain command-line option in order for this trick to work.
Thanks to the following for inspiring this experiment and providing example code that helped me figure out how this stuff fits together:
Public domain! Go nuts!