Migrate application to Maven

This commit migrates the `initializr-service` to a regular Maven project.

Closes gh-252
This commit is contained in:
Stephane Nicoll
2016-06-30 16:06:44 +02:00
parent 98a1049cec
commit 1fd8e2c047
10 changed files with 144 additions and 116 deletions

View File

@@ -1,39 +0,0 @@
package app
import java.util.concurrent.Executor
import org.springframework.context.annotation.Configuration
import org.springframework.scheduling.annotation.AsyncConfigurerSupport
import org.springframework.scheduling.annotation.EnableAsync
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
import io.spring.initializr.web.project.LegacyStsController
@Grab('io.spring.initializr:initializr-actuator:1.0.0.BUILD-SNAPSHOT')
@Grab('io.spring.initializr:initializr-web:1.0.0.BUILD-SNAPSHOT')
@Grab('spring-boot-starter-web')
@Grab('spring-boot-starter-redis')
class InitializerService {
@Bean
@SuppressWarnings("deprecation")
LegacyStsController legacyStsController() {
new LegacyStsController()
}
@Configuration
@EnableAsync
static class AsyncConfiguration extends AsyncConfigurerSupport {
@Override
Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor()
executor.setCorePoolSize(1)
executor.setMaxPoolSize(5)
executor.setThreadNamePrefix("initializr-")
executor.initialize()
executor
}
}
}

View File

@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<!--logger name="org.springframework" level="DEBUG"/-->
<logger name="org.springframework.core.env" level="WARN"/>
<logger name="org.springframework.jndi" level="WARN"/>
</configuration>

View File

@@ -1,7 +0,0 @@
---
applications:
- name: start
memory: 1024M
host: start-development
domain: cfapps.io
path: .

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>io.spring.initializr</groupId>
<artifactId>initializr</artifactId>
<version>1.0.0.BUILD-SNAPSHOT</version>
</parent>
<artifactId>initializr-service</artifactId>
<name>Spring Initializr :: Service</name>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>io.spring.initializr</groupId>
<artifactId>initializr-web</artifactId>
</dependency>
<dependency>
<groupId>io.spring.initializr</groupId>
<artifactId>initializr-actuator</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,67 @@
/*
* Copyright 2012-2016 the original author or authors.
*
* 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 io.spring.initializr.service
import java.util.concurrent.Executor
import io.spring.initializr.web.project.LegacyStsController
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.scheduling.annotation.AsyncConfigurerSupport
import org.springframework.scheduling.annotation.EnableAsync
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
/**
* Initializr service application. Enables legacy STS support for older
* clients.
*
* @author Stephane Nicoll
* @since 1.0
*/
@SpringBootApplication
class InitializrService {
public static void main(String[] args) {
SpringApplication.run(InitializrService, args)
}
@Bean
@SuppressWarnings("deprecation")
LegacyStsController legacyStsController() {
new LegacyStsController()
}
@Configuration
@EnableAsync
static class AsyncConfiguration extends AsyncConfigurerSupport {
@Override
Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor()
executor.setCorePoolSize(1)
executor.setMaxPoolSize(5)
executor.setThreadNamePrefix("initializr-")
executor.initialize()
executor
}
}
}

View File

@@ -6,6 +6,11 @@ info:
spring-boot:
version: 1.3.6.RELEASE
logging:
level:
org.springframework.core.env: warn
org.springframework.jndi: warn
server:
compression:
enabled: true