Skip to content

Commit 0cd00a4

Browse files
committed
init project
0 parents  commit 0cd00a4

File tree

310 files changed

+94473
-0
lines changed

Some content is hidden

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

310 files changed

+94473
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea
5+
.DS_Store
6+
/build
7+
/captures
8+
.externalNativeBuild
9+
.cxx

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
plugins {
2+
//id 'org.springframework.boot' version '1.4.4.RELEASE' apply false
3+
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
4+
}
5+
6+
apply plugin: 'com.android.application'
7+
8+
dependencyManagement {
9+
imports {
10+
mavenBom 'org.springframework.boot:spring-boot-starter-parent:1.4.4.RELEASE'
11+
}
12+
}
13+
14+
android {
15+
compileSdkVersion 29
16+
buildToolsVersion "29.0.3"
17+
18+
defaultConfig {
19+
applicationId "com.example.myapplication"
20+
minSdkVersion 19
21+
targetSdkVersion 29
22+
versionCode 1
23+
versionName "1.0"
24+
multiDexEnabled true
25+
26+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
27+
}
28+
29+
30+
packagingOptions {
31+
merge 'META-INF/spring.factories'
32+
exclude 'META-INF/spring-configuration-metadata.json'
33+
exclude 'META-INF/additional-spring-configuration-metadata.json'
34+
exclude 'META-INF/spring.tooling'
35+
exclude 'META-INF/spring.handlers'
36+
exclude 'META-INF/license.txt'
37+
exclude 'META-INF/web-fragment.xml'
38+
exclude 'META-INF/spring.provides'
39+
exclude 'META-INF/spring.schemas'
40+
exclude 'META-INF/notice.txt'
41+
exclude 'META-INF/INDEX.LIST'
42+
exclude 'META-INF/groovy-release-info.properties'
43+
}
44+
45+
buildTypes {
46+
release {
47+
minifyEnabled false
48+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
49+
}
50+
}
51+
52+
}
53+
54+
dependencies {
55+
implementation fileTree(include: ['*.jar'], dir: 'libs')
56+
implementation 'androidx.multidex:multidex:2.0.1'
57+
implementation 'androidx.appcompat:appcompat:1.0.2'
58+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
59+
implementation 'org.springframework.boot:spring-boot-starter-web'
60+
implementation 'org.aspectj:aspectjrt:1.8.9'
61+
implementation ("org.hibernate:hibernate-core:5.1.2.Final") {
62+
exclude group: 'org.hibernate.javax.persistence', module: 'hibernate-jpa-2.1-api'
63+
}
64+
implementation ("org.hibernate:hibernate-ehcache:5.1.2.Final") {
65+
exclude group: 'org.hibernate.javax.persistence', module: 'hibernate-jpa-2.1-api'
66+
}
67+
implementation "org.codehaus.groovy:groovy-templates:2.4.7"
68+
implementation "javax.activation:activation:1.1"
69+
implementation "javax.mail:javax.mail-api:1.5.6"
70+
implementation "org.springframework:spring-context-support"
71+
implementation ("org.springframework.security:spring-security-core") {
72+
exclude group: 'aopalliance', module:'aopalliance'
73+
}
74+
implementation "org.springframework:spring-tx"
75+
implementation "org.springframework:spring-websocket"
76+
implementation "org.springframework:spring-orm"
77+
implementation "org.apache.tomcat.embed:tomcat-embed-core"
78+
implementation "com.google.code.gson:gson:2.8.5"
79+
runtimeOnly "com.h2database:h2:1.4.200"
80+
runtimeOnly 'mysql:mysql-connector-java:5.1.36'
81+
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
82+
testImplementation 'junit:junit:4.12'
83+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
84+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
85+
implementation files('libs/beans.jar')
86+
implementation project(path: ':mbeanserver')
87+
}

app/libs/beans.jar

144 KB
Binary file not shown.

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.example.myapplication;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
25+
assertEquals("com.example.myapplication", appContext.getPackageName());
26+
}
27+
}

app/src/main/AndroidManifest.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.myapplication">
4+
5+
<uses-permission android:name="android.permission.INTERNET"/>
6+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
7+
8+
<application
9+
android:name="androidx.multidex.MultiDexApplication"
10+
android:allowBackup="true"
11+
android:icon="@mipmap/ic_launcher"
12+
android:label="@string/app_name"
13+
android:roundIcon="@mipmap/ic_launcher_round"
14+
android:supportsRtl="true"
15+
android:theme="@style/AppTheme">
16+
<service
17+
android:name=".MyService"
18+
android:enabled="true"
19+
android:exported="false"
20+
android:process=":service">
21+
</service>
22+
23+
<activity android:name=".MainActivity">
24+
<intent-filter>
25+
<action android:name="android.intent.action.MAIN" />
26+
27+
<category android:name="android.intent.category.LAUNCHER" />
28+
</intent-filter>
29+
</activity>
30+
</application>
31+
32+
</manifest>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.example.myapplication;
2+
3+
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.context.annotation.ConfigurationClassPostProcessor;
6+
7+
@Configuration("org.springframework.context.annotation.internalConfigurationAnnotationProcessor")
8+
public class AndroidConfigurationClassPostProcessor extends ConfigurationClassPostProcessor {
9+
public AndroidConfigurationClassPostProcessor() {
10+
super();
11+
this.setMetadataReaderFactory(new AndroidMetadataReaderFactory());
12+
}
13+
14+
@Override
15+
public void enhanceConfigurationClasses(ConfigurableListableBeanFactory beanFactory) {
16+
17+
}
18+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package com.example.myapplication;
2+
3+
4+
import org.springframework.core.io.DescriptiveResource;
5+
import org.springframework.core.io.Resource;
6+
import org.springframework.core.type.AnnotationMetadata;
7+
import org.springframework.core.type.ClassMetadata;
8+
import org.springframework.core.type.StandardAnnotationMetadata;
9+
import org.springframework.core.type.classreading.MetadataReader;
10+
11+
public class AndroidMetadataReader implements MetadataReader {
12+
private AnnotationMetadata annotationMetadata;
13+
private Resource resource;
14+
15+
public AndroidMetadataReader(Class<?> aClass) {
16+
this.annotationMetadata = new StandardAnnotationMetadata(aClass);
17+
this.resource = new DescriptiveResource(aClass.getName());
18+
}
19+
20+
void setAnnotationMetadata(AnnotationMetadata annotationMetadata) {
21+
this.annotationMetadata = annotationMetadata;
22+
}
23+
24+
@Override
25+
public Resource getResource() {
26+
return resource;
27+
}
28+
29+
@Override
30+
public ClassMetadata getClassMetadata() {
31+
return annotationMetadata;
32+
}
33+
34+
@Override
35+
public AnnotationMetadata getAnnotationMetadata() {
36+
return annotationMetadata;
37+
}
38+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package com.example.myapplication;
2+
3+
4+
import android.util.Log;
5+
6+
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfigurationEmbeddedTomcat;
7+
import org.springframework.context.annotation.Configuration;
8+
import org.springframework.core.io.Resource;
9+
import org.springframework.core.type.AnnotationMetadata;
10+
import org.springframework.core.type.ClassMetadata;
11+
import org.springframework.core.type.MethodMetadata;
12+
import org.springframework.core.type.classreading.MetadataReader;
13+
import org.springframework.core.type.classreading.MetadataReaderFactory;
14+
import org.springframework.util.MultiValueMap;
15+
16+
import java.io.IOException;
17+
import java.util.Map;
18+
import java.util.Set;
19+
import java.util.stream.Stream;
20+
21+
@Configuration("org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory")
22+
public class AndroidMetadataReaderFactory implements MetadataReaderFactory {
23+
private MetadataReader defaultReader = new AndroidMetadataReader(Object.class);
24+
@Override
25+
public MetadataReader getMetadataReader(String className) throws IOException {
26+
// if ("org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat".equals(className)) {
27+
// return new AndroidMetadataReader(EmbeddedServletContainerAutoConfigurationEmbeddedTomcat.class);
28+
// }
29+
AndroidMetadataReader metadataReader = null;
30+
try {
31+
metadataReader = new AndroidMetadataReader(Class.forName(className));
32+
} catch (ClassNotFoundException e) {
33+
Log.e("AndroidMetadataReader", className + " not found");
34+
throw new IOException(e);
35+
} catch (NoClassDefFoundError error) {
36+
Log.d("AndroidMetadataReader", className + " def error", error);
37+
return defaultReader;
38+
}
39+
if ("org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration".equals(className)) {
40+
metadataReader.setAnnotationMetadata(new AnnotationMetadataProxy(metadataReader.getAnnotationMetadata()) {
41+
@Override
42+
public String[] getMemberClassNames() {
43+
String[] memberClassNames = annotationMetadata.getMemberClassNames();
44+
for (int i=0;i<memberClassNames.length;++i) {
45+
if ("org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat".equals(memberClassNames[i])) {
46+
memberClassNames[i] = EmbeddedServletContainerAutoConfigurationEmbeddedTomcat.class.getName();
47+
}
48+
}
49+
return memberClassNames;
50+
}
51+
});
52+
}
53+
return metadataReader;
54+
}
55+
56+
@Override
57+
public MetadataReader getMetadataReader(Resource resource) throws IOException {
58+
return getMetadataReader(resource.getDescription());
59+
}
60+
}

0 commit comments

Comments
 (0)