Skip to content
This repository was archived by the owner on Apr 22, 2025. It is now read-only.

Commit d3ca131

Browse files
author
hainguyen
committed
* Upgrade spring boot2 libraries
* Align with the micro services architect * Fox kotlin spring integration issues
1 parent 80169c5 commit d3ca131

File tree

121 files changed

+633
-1443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+633
-1443
lines changed

mycollab-app-community/src/main/config/mycollab.properties.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#=====================================================
2-
# You can visit link https://community.mycollab.com/configuration/
2+
# You can visit link http://community.mycollab.com/configuration/
33
# to get all configuration fieldBuilder and their meanings
44
#=====================================================
55

mycollab-app-community/src/main/docker/app.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
version: '3.1'
22
services:
33
hlsoft-mysql:
4-
image: mysql:latest
4+
image: mysql:8.0.11
55
restart: always
66
hostname: mysql
77
command: mysqld --default-authentication-plugin=mysql_native_password
88
ports:
99
- "3306:3306"
1010
environment:
11-
MYSQL_ROOT_PASSWORD: esofthead321
11+
MYSQL_ROOT_PASSWORD: mycollab123
1212
MYSQL_DATABASE: mycollab
1313
hlsoft-app:
1414
image: mycollab/mycollab

mycollab-caching/src/main/java/com/mycollab/cache/service/impl/InfinispanCacheService.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ import org.springframework.stereotype.Service
3030
* @since 5.1.4
3131
*/
3232
@Service
33-
@Profile("production")
33+
@Profile("program")
3434
class InfinispanCacheService(private val instance: EmbeddedCacheManager) : CacheService {
3535

3636
override fun putValue(group: String, key: String, value: Any) {
3737
val cache = getCache(group)
38-
cache.put(key, value)
38+
cache[key] = value
3939
}
4040

4141
private fun getCache(group: String): BasicCache<String, Any> {

mycollab-caching/src/main/java/com/mycollab/cache/spring/CacheConfiguration.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ import org.springframework.context.annotation.Configuration
2424
import org.springframework.context.annotation.Profile
2525

2626
@Configuration
27-
@Profile("production")
28-
open class CacheConfiguration {
27+
@Profile("program")
28+
class CacheConfiguration {
2929

3030
@Bean
31-
open fun cacheConfigurer(): InfinispanCacheConfigurer {
31+
fun cacheConfigurer(): InfinispanCacheConfigurer {
3232
return InfinispanCacheConfigurer {
3333
val ispnConfig = ConfigurationBuilder()
3434
.clustering()

mycollab-caching/src/main/java/com/mycollab/concurrent/DistributionLockUtil.kt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,13 @@ object DistributionLockUtil {
3535

3636
private val map = Collections.synchronizedMap(ReferenceMap(AbstractReferenceMap.WEAK, AbstractReferenceMap.WEAK))
3737

38-
@JvmStatic fun getLock(lockName: String): Lock {
39-
return try {
40-
val lockService = AppContextUtil.getSpringBean(DistributionLockService::class.java)
41-
val lock = lockService.getLock(lockName)
42-
lock ?: getStaticDefaultLock(lockName)
43-
} catch (e: Exception) {
44-
LOG.warn("Can not get lock service", e)
45-
getStaticDefaultLock(lockName)
46-
}
47-
38+
@JvmStatic fun getLock(lockName: String): Lock = try {
39+
val lockService = AppContextUtil.getSpringBean(DistributionLockService::class.java)
40+
val lock = lockService.getLock(lockName)
41+
lock ?: getStaticDefaultLock(lockName)
42+
} catch (e: Exception) {
43+
LOG.warn("Can not get lock service")
44+
getStaticDefaultLock(lockName)
4845
}
4946

5047
@JvmStatic fun removeLock(lockName: String) {
@@ -57,7 +54,7 @@ object DistributionLockUtil {
5754
when (lock) {
5855
null -> {
5956
lock = ReentrantLock()
60-
map.put(lockName, lock)
57+
map[lockName] = lock
6158
}
6259
}
6360
return lock!!

mycollab-client-api/src/main/kotlin/com/mycollab/module/project/rest/ProjectController.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ProjectController {
2323
@Autowired
2424
private lateinit var projectService: ProjectService
2525

26-
@RequestMapping(method = arrayOf(RequestMethod.GET))
26+
@RequestMapping(method = [(RequestMethod.GET)])
2727
fun list(@PathVariable accountId: Int,
2828
@RequestParam(value = "offset", required = false, defaultValue = "0") offset: Int?,
2929
@RequestParam(value = "limit", required = false) limit: Int?): List<*> {

mycollab-config/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,11 @@
2929
<artifactId>jasypt</artifactId>
3030
<version>1.9.2</version>
3131
</dependency>
32+
33+
<dependency>
34+
<groupId>org.freemarker</groupId>
35+
<artifactId>freemarker-gae</artifactId>
36+
<version>2.3.28</version>
37+
</dependency>
3238
</dependencies>
3339
</project>

mycollab-config/src/main/java/com/mycollab/configuration/ApplicationConfiguration.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ import org.springframework.stereotype.Component
2525
* @since 5.5.0
2626
*/
2727
@Component
28-
@Profile("production", "test")
28+
@Profile("program", "test")
2929
@ConfigurationProperties(prefix = "app")
30-
open class ApplicationConfiguration(var description: String? = "", var facebookUrl: String? = "",
30+
open class ApplicationConfiguration(var siteName: String = "MyCollab", var description: String? = "", var facebookUrl: String? = "",
3131
var twitterUrl: String? = "", var googleUrl: String? = "",
32-
var linkedinUrl: String? = "") {
32+
var linkedinUrl: String? = "", var notifyEmail: String) {
3333

34-
fun defaultUrls(): MutableMap<String, String> =
35-
mutableMapOf<String, String>("facebook_url" to (facebookUrl ?: ""),
34+
constructor(): this("", "", "", "", "", "", "")
35+
36+
fun defaultUrls() =
37+
mutableMapOf("facebook_url" to (facebookUrl ?: ""),
3638
"google_url" to (googleUrl ?: ""),
3739
"linkedin_url" to (linkedinUrl ?: ""),
3840
"twitter_url" to (twitterUrl ?: ""))

mycollab-config/src/main/java/com/mycollab/configuration/ApplicationProperties.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ public class ApplicationProperties {
4040

4141
private static Properties properties;
4242

43-
public static final String DB_USERNAME = "db.username";
44-
public static final String DB_PASSWORD = "db.password";
45-
public static final String DB_DRIVER_CLASS = "db.driverClassName";
46-
public static final String DB_URL = "db.url";
47-
48-
public static final String CDN_URL = "cdn.url";
49-
public static final String APP_URL = "app.url";
50-
5143
public static final String MAIL_SMTPHOST = "mail.smtphost";
5244
public static final String MAIL_PORT = "mail.port";
5345
public static final String MAIL_USERNAME = "mail.username";
@@ -56,11 +48,6 @@ public class ApplicationProperties {
5648
public static final String MAIL_IS_SSL = "mail.isSSL";
5749
public static final String MAIL_NOTIFY = "mail.notify";
5850

59-
public static final String ERROR_SENDTO = "error.sendTo";
60-
61-
public static final String SITE_NAME = "site.name";
62-
public static final String SERVER_ADDRESS = "server.address";
63-
6451
public static final String DROPBOX_AUTH_LINK = "dropbox.callbackUrl";
6552

6653
public static final String BI_ENDECRYPT_PASSWORD = "endecryptPassword";

mycollab-config/src/main/java/com/mycollab/configuration/DatabaseConfiguration.kt

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,18 @@
1414
* You should have received a copy of the GNU Affero General Public License
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
17-
/**
18-
* mycollab-config - Parent pom providing dependency and plugin management for applications
19-
built with Maven
20-
* Copyright © 2017 MyCollab (support@mycollab.com)
21-
*
22-
* This program is free software: you can redistribute it and/or modify
23-
* it under the terms of the GNU General Public License as published by
24-
* the Free Software Foundation, either version 3 of the License, or
25-
* (at your option) any later version.
26-
*
27-
* This program is distributed in the hope that it will be useful,
28-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
29-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30-
* GNU General Public License for more details.
31-
*
32-
* You should have received a copy of the GNU General Public License
33-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
34-
*/
3517
package com.mycollab.configuration
3618

19+
import org.springframework.boot.context.properties.ConfigurationProperties
20+
import org.springframework.context.annotation.Profile
21+
import org.springframework.stereotype.Component
22+
3723
/**
3824
* @author MyCollab Ltd
3925
* @since 6.0.0
4026
*/
41-
class DatabaseConfiguration(var driverClass: String, var url: String,
42-
var user: String, var password: String)
27+
@Profile("program")
28+
@Component
29+
@ConfigurationProperties(prefix = "spring.datasource")
30+
class DatabaseConfiguration(var driverClassName: String = "", var url: String = "",
31+
var username: String = "", var password: String = "")

0 commit comments

Comments
 (0)