Refactor project structure and update configurations for improved resource handling
This commit is contained in:
@@ -43,3 +43,4 @@ out/
|
||||
/logs/application.log
|
||||
/logs/
|
||||
/.idea/
|
||||
/src/main/resources/static/
|
||||
|
||||
+11
-5
@@ -67,12 +67,12 @@ apply plugin: 'io.spring.dependency-management'
|
||||
|
||||
apply plugin: 'java'
|
||||
|
||||
tasks.register('copyResources', Copy) {
|
||||
/*tasks.register('copyResources', Copy) {
|
||||
from 'jambotron-ui/dist/jambotron-ui/browser'
|
||||
into 'src/main/resources/public'
|
||||
}
|
||||
processResources.dependsOn(copyResources)
|
||||
compileJava.dependsOn(copyResources)
|
||||
}*/
|
||||
//processResources.dependsOn(copyResources)
|
||||
//compileJava.dependsOn(copyResources)
|
||||
//bootRun.dependsOn("flywayMigrate")
|
||||
|
||||
//flyway {
|
||||
@@ -84,12 +84,18 @@ compileJava.dependsOn(copyResources)
|
||||
// locations = ['filesystem:src/main/resources/db.migration/']
|
||||
//}
|
||||
|
||||
sourceSets {
|
||||
/*sourceSets {
|
||||
main {
|
||||
resources {
|
||||
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') {
|
||||
|
||||
+10
-11
@@ -15,9 +15,12 @@
|
||||
"prefix": "app",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular/build:application",
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"browser": "src/main.ts",
|
||||
"outputPath": "dist/jambotron-ui",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
|
||||
"polyfills": [
|
||||
"zone.js"
|
||||
],
|
||||
@@ -37,12 +40,8 @@
|
||||
"styles": [
|
||||
"@angular/material/prebuilt-themes/azure-blue.css",
|
||||
"src/styles.scss"
|
||||
],
|
||||
"server": "src/main.server.ts",
|
||||
"outputMode": "server",
|
||||
"ssr": {
|
||||
"entry": "src/server.ts"
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
@@ -50,7 +49,7 @@
|
||||
{
|
||||
"type": "initial",
|
||||
"maximumWarning": "500kB",
|
||||
"maximumError": "1MB"
|
||||
"maximumError": "5MB"
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
@@ -69,7 +68,7 @@
|
||||
"defaultConfiguration": "production"
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular/build:dev-server",
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"configurations": {
|
||||
"production": {
|
||||
"buildTarget": "jambotron-ui:build:production"
|
||||
@@ -81,7 +80,7 @@
|
||||
"defaultConfiguration": "development"
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular/build:extract-i18n"
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n"
|
||||
},
|
||||
"test": {
|
||||
"builder": "@angular/build:karma",
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
"zone.js": "~0.15.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular/build": "^20.0.2",
|
||||
"@angular-devkit/build-angular": "^20.0.2",
|
||||
"@angular/cli": "^20.0.2",
|
||||
"@angular/compiler-cli": "^20.0.0",
|
||||
"@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 {SettingsComponent} from './admin-module/settings.component/settings.component';
|
||||
import {SystemComponent} from './admin-module/system.component/system.component';
|
||||
import {appRouting} from './app.routes';
|
||||
import {AppRoutingModule} from './app.routes';
|
||||
import {App} from './app';
|
||||
|
||||
@NgModule({
|
||||
@@ -21,7 +21,7 @@ import {App} from './app';
|
||||
|
||||
],
|
||||
imports: [
|
||||
appRouting,
|
||||
AppRoutingModule,
|
||||
MainComponent,
|
||||
BrowserModule,
|
||||
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) {
|
||||
<button mat-raised-button routerLink="system" >
|
||||
<button mat-raised-button routerLink="admin/system" >
|
||||
<mat-icon>settings_applications</mat-icon>
|
||||
System
|
||||
</button>
|
||||
|
||||
@@ -2,10 +2,13 @@ package com.jambotronGroup.jambotron.configuretions;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
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.WebMvcConfigurer;
|
||||
|
||||
/*
|
||||
@Configuration
|
||||
|
||||
@EnableWebMvc
|
||||
public class MvcConfig implements WebMvcConfigurer {
|
||||
@Value("${spring.resources.static-locations}")
|
||||
String resourceLocations;
|
||||
@@ -13,7 +16,10 @@ public class MvcConfig implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
//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.nio.charset.Charset;
|
||||
/*
|
||||
|
||||
@ControllerAdvice
|
||||
public class NotFoundHandler {
|
||||
@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()
|
||||
.requestMatchers("/*", "/home", "/resources/**").permitAll()
|
||||
.requestMatchers("/resources/public/media/**").permitAll()
|
||||
.requestMatchers("/resources/public/browser/**").permitAll()
|
||||
.requestMatchers("/media/**").permitAll()
|
||||
.requestMatchers("/api/test/**").permitAll()
|
||||
.requestMatchers("/api/tutorials").permitAll()
|
||||
|
||||
@@ -29,10 +29,12 @@ spring.mvc.throw-exception-if-no-handler-found=true
|
||||
# Disable the default mappings
|
||||
#spring.resources.add-mappings=false
|
||||
|
||||
spring.resources.static-locations=classpath:/public
|
||||
spring.resources.cache.period=31557600s # 1 year if you want
|
||||
spa.default-file=classpath:/public/browser/index.html
|
||||
|
||||
# UI(index.html) location
|
||||
#spring.resources.static-locations=classpath:/public/browser/
|
||||
#
|
||||
#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
|
||||
|
||||
@@ -44,5 +46,7 @@ spring.flyway.password=postgrespw
|
||||
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