Refactor project structure and update configurations for improved resource handling
This commit is contained in:
@@ -43,3 +43,4 @@ out/
|
|||||||
/logs/application.log
|
/logs/application.log
|
||||||
/logs/
|
/logs/
|
||||||
/.idea/
|
/.idea/
|
||||||
|
/src/main/resources/static/
|
||||||
|
|||||||
+11
-5
@@ -67,12 +67,12 @@ apply plugin: 'io.spring.dependency-management'
|
|||||||
|
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
|
|
||||||
tasks.register('copyResources', Copy) {
|
/*tasks.register('copyResources', Copy) {
|
||||||
from 'jambotron-ui/dist/jambotron-ui/browser'
|
from 'jambotron-ui/dist/jambotron-ui/browser'
|
||||||
into 'src/main/resources/public'
|
into 'src/main/resources/public'
|
||||||
}
|
}*/
|
||||||
processResources.dependsOn(copyResources)
|
//processResources.dependsOn(copyResources)
|
||||||
compileJava.dependsOn(copyResources)
|
//compileJava.dependsOn(copyResources)
|
||||||
//bootRun.dependsOn("flywayMigrate")
|
//bootRun.dependsOn("flywayMigrate")
|
||||||
|
|
||||||
//flyway {
|
//flyway {
|
||||||
@@ -84,12 +84,18 @@ compileJava.dependsOn(copyResources)
|
|||||||
// locations = ['filesystem:src/main/resources/db.migration/']
|
// locations = ['filesystem:src/main/resources/db.migration/']
|
||||||
//}
|
//}
|
||||||
|
|
||||||
sourceSets {
|
/*sourceSets {
|
||||||
main {
|
main {
|
||||||
resources {
|
resources {
|
||||||
srcDir 'jambotron-ui/dist/jambotron-ui/browser'
|
srcDir 'jambotron-ui/dist/jambotron-ui/browser'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
tasks.register('copyAngularBuild', Copy) {
|
||||||
|
//dependsOn buildAngular
|
||||||
|
from 'jambotron-ui/dist/jambotron-ui' // Path to your Angular dist folder
|
||||||
|
into "src/main/resources/static" // Path INSIDE the WAR
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('test') {
|
tasks.named('test') {
|
||||||
|
|||||||
+10
-11
@@ -15,9 +15,12 @@
|
|||||||
"prefix": "app",
|
"prefix": "app",
|
||||||
"architect": {
|
"architect": {
|
||||||
"build": {
|
"build": {
|
||||||
"builder": "@angular/build:application",
|
"builder": "@angular-devkit/build-angular:browser",
|
||||||
"options": {
|
"options": {
|
||||||
"browser": "src/main.ts",
|
"outputPath": "dist/jambotron-ui",
|
||||||
|
"index": "src/index.html",
|
||||||
|
"main": "src/main.ts",
|
||||||
|
|
||||||
"polyfills": [
|
"polyfills": [
|
||||||
"zone.js"
|
"zone.js"
|
||||||
],
|
],
|
||||||
@@ -37,12 +40,8 @@
|
|||||||
"styles": [
|
"styles": [
|
||||||
"@angular/material/prebuilt-themes/azure-blue.css",
|
"@angular/material/prebuilt-themes/azure-blue.css",
|
||||||
"src/styles.scss"
|
"src/styles.scss"
|
||||||
],
|
]
|
||||||
"server": "src/main.server.ts",
|
|
||||||
"outputMode": "server",
|
|
||||||
"ssr": {
|
|
||||||
"entry": "src/server.ts"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
@@ -50,7 +49,7 @@
|
|||||||
{
|
{
|
||||||
"type": "initial",
|
"type": "initial",
|
||||||
"maximumWarning": "500kB",
|
"maximumWarning": "500kB",
|
||||||
"maximumError": "1MB"
|
"maximumError": "5MB"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "anyComponentStyle",
|
"type": "anyComponentStyle",
|
||||||
@@ -69,7 +68,7 @@
|
|||||||
"defaultConfiguration": "production"
|
"defaultConfiguration": "production"
|
||||||
},
|
},
|
||||||
"serve": {
|
"serve": {
|
||||||
"builder": "@angular/build:dev-server",
|
"builder": "@angular-devkit/build-angular:dev-server",
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
"buildTarget": "jambotron-ui:build:production"
|
"buildTarget": "jambotron-ui:build:production"
|
||||||
@@ -81,7 +80,7 @@
|
|||||||
"defaultConfiguration": "development"
|
"defaultConfiguration": "development"
|
||||||
},
|
},
|
||||||
"extract-i18n": {
|
"extract-i18n": {
|
||||||
"builder": "@angular/build:extract-i18n"
|
"builder": "@angular-devkit/build-angular:extract-i18n"
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"builder": "@angular/build:karma",
|
"builder": "@angular/build:karma",
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
"zone.js": "~0.15.0"
|
"zone.js": "~0.15.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular/build": "^20.0.2",
|
"@angular-devkit/build-angular": "^20.0.2",
|
||||||
"@angular/cli": "^20.0.2",
|
"@angular/cli": "^20.0.2",
|
||||||
"@angular/compiler-cli": "^20.0.0",
|
"@angular/compiler-cli": "^20.0.0",
|
||||||
"@types/express": "^5.0.1",
|
"@types/express": "^5.0.1",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {AdminComponent} from './admin-module/admin.component/admin.component';
|
|||||||
import {AdminWelcomeComponent} from './admin-module/admin-welcome.component/admin-welcome.component';
|
import {AdminWelcomeComponent} from './admin-module/admin-welcome.component/admin-welcome.component';
|
||||||
import {SettingsComponent} from './admin-module/settings.component/settings.component';
|
import {SettingsComponent} from './admin-module/settings.component/settings.component';
|
||||||
import {SystemComponent} from './admin-module/system.component/system.component';
|
import {SystemComponent} from './admin-module/system.component/system.component';
|
||||||
import {appRouting} from './app.routes';
|
import {AppRoutingModule} from './app.routes';
|
||||||
import {App} from './app';
|
import {App} from './app';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -21,7 +21,7 @@ import {App} from './app';
|
|||||||
|
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
appRouting,
|
AppRoutingModule,
|
||||||
MainComponent,
|
MainComponent,
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
|
|||||||
@@ -16,5 +16,9 @@ export const routes: Routes = [
|
|||||||
}
|
}
|
||||||
|
|
||||||
];
|
];
|
||||||
export const appRouting = RouterModule.forRoot(routes);
|
@NgModule({
|
||||||
|
imports: [RouterModule.forRoot(routes)],//, { useHash: true }
|
||||||
|
exports: [RouterModule],
|
||||||
|
})
|
||||||
|
export class AppRoutingModule {}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@if (showAdminBoard) {
|
@if (showAdminBoard) {
|
||||||
<button mat-raised-button routerLink="system" >
|
<button mat-raised-button routerLink="admin/system" >
|
||||||
<mat-icon>settings_applications</mat-icon>
|
<mat-icon>settings_applications</mat-icon>
|
||||||
System
|
System
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ package com.jambotronGroup.jambotron.configuretions;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
/*
|
||||||
@Configuration
|
@Configuration
|
||||||
|
|
||||||
|
@EnableWebMvc
|
||||||
public class MvcConfig implements WebMvcConfigurer {
|
public class MvcConfig implements WebMvcConfigurer {
|
||||||
@Value("${spring.resources.static-locations}")
|
@Value("${spring.resources.static-locations}")
|
||||||
String resourceLocations;
|
String resourceLocations;
|
||||||
@@ -13,7 +16,10 @@ public class MvcConfig implements WebMvcConfigurer {
|
|||||||
@Override
|
@Override
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
//registry.addResourceHandler("/public/**").addResourceLocations(resourceLocations);
|
//registry.addResourceHandler("/public/**").addResourceLocations(resourceLocations);
|
||||||
// registry.addResourceHandler("/media/**").addResourceLocations("resources/main/public/media/");
|
registry.addResourceHandler("/**").addResourceLocations("classpath:/resources/");
|
||||||
|
|
||||||
|
//registry.
|
||||||
|
registry.addResourceHandler("/media/**").addResourceLocations("resources/main/public/media/");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import java.io.FileInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@ControllerAdvice
|
@ControllerAdvice
|
||||||
public class NotFoundHandler {
|
public class NotFoundHandler {
|
||||||
@Value("${spa.default-file}")
|
@Value("${spa.default-file}")
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.jambotronGroup.jambotron.controllers;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
/*@Controller
|
||||||
|
public class RedirectController {
|
||||||
|
@RequestMapping(value = "/{path:[^\\.]*}")
|
||||||
|
public String redirect() {
|
||||||
|
return "forward:/index.html";
|
||||||
|
}
|
||||||
|
}*/
|
||||||
@@ -106,6 +106,7 @@ public class WebSecurityConfig {// extends WebSecurityConfigurerAdapter {
|
|||||||
auth.requestMatchers("/api/auth/**").permitAll()
|
auth.requestMatchers("/api/auth/**").permitAll()
|
||||||
.requestMatchers("/*", "/home", "/resources/**").permitAll()
|
.requestMatchers("/*", "/home", "/resources/**").permitAll()
|
||||||
.requestMatchers("/resources/public/media/**").permitAll()
|
.requestMatchers("/resources/public/media/**").permitAll()
|
||||||
|
.requestMatchers("/resources/public/browser/**").permitAll()
|
||||||
.requestMatchers("/media/**").permitAll()
|
.requestMatchers("/media/**").permitAll()
|
||||||
.requestMatchers("/api/test/**").permitAll()
|
.requestMatchers("/api/test/**").permitAll()
|
||||||
.requestMatchers("/api/tutorials").permitAll()
|
.requestMatchers("/api/tutorials").permitAll()
|
||||||
|
|||||||
@@ -29,10 +29,12 @@ spring.mvc.throw-exception-if-no-handler-found=true
|
|||||||
# Disable the default mappings
|
# Disable the default mappings
|
||||||
#spring.resources.add-mappings=false
|
#spring.resources.add-mappings=false
|
||||||
|
|
||||||
spring.resources.static-locations=classpath:/public
|
# UI(index.html) location
|
||||||
spring.resources.cache.period=31557600s # 1 year if you want
|
#spring.resources.static-locations=classpath:/public/browser/
|
||||||
spa.default-file=classpath:/public/browser/index.html
|
#
|
||||||
|
#spring.resources.cache.period=31557600s # 1 year if you want
|
||||||
|
#spa.default-file=classpath:/public/browser/index.html
|
||||||
|
#
|
||||||
|
|
||||||
spring.docker.compose.file=../Docker/docker-compose.yml
|
spring.docker.compose.file=../Docker/docker-compose.yml
|
||||||
|
|
||||||
@@ -44,5 +46,7 @@ spring.flyway.password=postgrespw
|
|||||||
spring.flyway.url=jdbc:postgresql://localhost:5432/jambotronDB
|
spring.flyway.url=jdbc:postgresql://localhost:5432/jambotronDB
|
||||||
|
|
||||||
|
|
||||||
spring.ai.zhipuai.base-url=https://open.bigmodel.cn/api/paas/v3
|
|
||||||
spring.ai.zhipuai.api-key = 628447c8c65845a48a7226391464a2ea.Dw8ci6TiW0BRF5LI
|
|
||||||
|
//spring.ai.zhipuai.base-url=https://open.bigmodel.cn/api/paas/v3
|
||||||
|
//spring.ai.zhipuai.api-key = 628447c8c65845a48a7226391464a2ea.Dw8ci6TiW0BRF5LI
|
||||||
Reference in New Issue
Block a user