forked from thymeleaf/thymeleaf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'thymeleafsandbox-biglist-3.1-spring6' into 3.1-dev
- Loading branch information
Showing
21 changed files
with
982 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,8 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
target/ | ||
bin/ | ||
.settings/ | ||
.idea/ | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ |
52 changes: 52 additions & 0 deletions
52
examples/springboot3/thymeleaf-examples-springboot3-biglist-mvc/README.markdown
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
Thymeleaf Sandbox: BigList, Spring Web MVC | ||
------------------------------------------- | ||
|
||
This is a sandbox application, only used internally for development. | ||
|
||
## Contents | ||
|
||
This sandbox repository contains an example application meant to test the use Thymeleaf rendering | ||
for very large amounts of markup using Spring Boot and Spring Web MVC (in comparison to Spring Web Reactive). | ||
|
||
See also: https://github.com/thymeleaf/thymeleafsandbox-biglist-reactive | ||
|
||
|
||
## Building | ||
|
||
To build this project you will need Maven 3. You can get it at: | ||
|
||
http://maven.apache.org | ||
|
||
Clean compilation: | ||
|
||
mvn -U clean compile | ||
Run the application (Spring Boot based, using **netty** as a web server): | ||
|
||
mvn spring-boot:run | ||
|
||
Once started, the application should be available at: | ||
|
||
http://localhost:8080 | ||
## Executing | ||
|
||
This application offers several URLs: | ||
|
||
* Index page: | ||
* `/` or `/thymeleaf`: index page using Thymeleaf. | ||
* `/freemarker`: index page using FreeMarker. | ||
* *Small* listing (8,715 elements, based on the MIT-licensed *Chinook* database for SQLite): | ||
* `/smalllist.thymeleaf`: *Small* listing using Thymeleaf. | ||
* `/smalllist.freemarker`: *Small* listing using FreeMarker. | ||
* `/smalllist.json`: *Small* listing in JSON. | ||
* *Big* listing (same 8,715 elements repeated 300 times = 2,614,500 elements): | ||
* `/biglist.thymeleaf`: *Big* listing using Thymeleaf. | ||
* `/biglist.freemarker`: *Big* listing using FreeMarker. | ||
* `/biglist.json`: *Big* listing in JSON. | ||
|
||
|
||
|
||
|
166 changes: 166 additions & 0 deletions
166
examples/springboot3/thymeleaf-examples-springboot3-biglist-mvc/pom.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- ========================================================================= --> | ||
<!-- --> | ||
<!-- Copyright (c) 2011-2016, The THYMELEAF team (http://www.thymeleaf.org) --> | ||
<!-- --> | ||
<!-- Licensed under the Apache License, Version 2.0 (the "License"); --> | ||
<!-- you may not use this file except in compliance with the License. --> | ||
<!-- You may obtain a copy of the License at --> | ||
<!-- --> | ||
<!-- http://www.apache.org/licenses/LICENSE-2.0 --> | ||
<!-- --> | ||
<!-- Unless required by applicable law or agreed to in writing, software --> | ||
<!-- distributed under the License is distributed on an "AS IS" BASIS, --> | ||
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or --> | ||
<!-- implied. See the License for the specific language governing --> | ||
<!-- permissions and limitations under the License. --> | ||
<!-- --> | ||
<!-- ========================================================================= --> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>thymeleafsandbox</groupId> | ||
<artifactId>biglist-mvc</artifactId> | ||
<version>ci</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>Thymeleaf Sandbox - BigList MVC</name> | ||
<description>Thymeleaf Sandbox - BigList MVC</description> | ||
|
||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
|
||
<licenses> | ||
<license> | ||
<name>The Apache Software License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
|
||
<organization> | ||
<name>The THYMELEAF team</name> | ||
<url>http://www.thymeleaf.org</url> | ||
</organization> | ||
|
||
<scm> | ||
<url>scm:git:[email protected]:thymeleaf/thymeleafsandbox-biglist-mvc.git</url> | ||
<connection>scm:git:[email protected]:thymeleaf/thymeleafsandbox-biglist-mvc.git</connection> | ||
<developerConnection>scm:git:[email protected]:thymeleaf/thymeleafsandbox-biglist-mvc.git</developerConnection> | ||
</scm> | ||
|
||
<developers> | ||
<developer> | ||
<id>dfernandez</id> | ||
<name>Daniel Fernandez</name> | ||
<email>daniel.fernandez AT 11thlabs DOT org</email> | ||
<roles> | ||
<role>Project admin</role> | ||
</roles> | ||
</developer> | ||
</developers> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<java.version>17</java.version> | ||
<thymeleaf.version>3.1.0-SNAPSHOT</thymeleaf.version> | ||
</properties> | ||
|
||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-thymeleaf</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-freemarker</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-jdbc</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.xerial</groupId> | ||
<artifactId>sqlite-jdbc</artifactId> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<repositories> | ||
<repository> | ||
<id>sonatype-nexus-snapshots</id> | ||
<name>Sonatype Nexus Snapshots</name> | ||
<url>https://oss.sonatype.org/content/repositories/snapshots</url> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
<repository> | ||
<id>jboss</id> | ||
<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
</repository> | ||
<repository> | ||
<id>spring-snapshots</id> | ||
<name>Spring Snapshots</name> | ||
<url>https://repo.spring.io/snapshot</url> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
<repository> | ||
<id>spring-milestones</id> | ||
<name>Spring Milestones</name> | ||
<url>https://repo.spring.io/milestone</url> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>spring-snapshots</id> | ||
<name>Spring Snapshots</name> | ||
<url>https://repo.spring.io/snapshot</url> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</pluginRepository> | ||
<pluginRepository> | ||
<id>spring-milestones</id> | ||
<name>Spring Milestones</name> | ||
<url>https://repo.spring.io/milestone</url> | ||
<snapshots> | ||
<enabled>false</enabled> | ||
</snapshots> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
</project> |
74 changes: 74 additions & 0 deletions
74
...pringboot3-biglist-mvc/src/main/java/thymeleafsandbox/biglistmvc/BigListMvcAppConfig.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* ============================================================================= | ||
* | ||
* Copyright (c) 2011-2014, The THYMELEAF team (http://www.thymeleaf.org) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* ============================================================================= | ||
*/ | ||
package thymeleafsandbox.biglistmvc; | ||
|
||
|
||
import java.io.IOException; | ||
|
||
import javax.sql.DataSource; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.boot.jdbc.DataSourceBuilder; | ||
import org.springframework.context.ApplicationContext; | ||
import org.springframework.context.ApplicationContextAware; | ||
import org.springframework.context.ApplicationContextException; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.core.io.Resource; | ||
|
||
@Configuration | ||
public class BigListMvcAppConfig implements ApplicationContextAware { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(BigListMvcAppConfig.class); | ||
|
||
|
||
private ApplicationContext applicationContext; | ||
|
||
|
||
public BigListMvcAppConfig() { | ||
super(); | ||
} | ||
|
||
|
||
@Override | ||
public void setApplicationContext(final ApplicationContext applicationContext) { | ||
this.applicationContext = applicationContext; | ||
} | ||
|
||
|
||
@Bean | ||
public DataSource dataSource() { | ||
try { | ||
|
||
final Resource dbResource = this.applicationContext.getResource("classpath:data/chinook.sqlite"); | ||
logger.debug("Database path: " + dbResource.getURL().getPath()); | ||
|
||
final DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create(); | ||
dataSourceBuilder.driverClassName("org.sqlite.JDBC"); | ||
dataSourceBuilder.url("jdbc:sqlite:" + dbResource.getURL().getPath()); | ||
return dataSourceBuilder.build(); | ||
|
||
} catch (final IOException e) { | ||
throw new ApplicationContextException("Error initializing database", e); | ||
} | ||
} | ||
|
||
} |
12 changes: 12 additions & 0 deletions
12
...ingboot3-biglist-mvc/src/main/java/thymeleafsandbox/biglistmvc/BigListMvcApplication.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package thymeleafsandbox.biglistmvc; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class BigListMvcApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(BigListMvcApplication.class, args); | ||
} | ||
} |
Oops, something went wrong.