私はスプリングブートとjavaでWebアプリケーションの構築を学んでいます。私はSpring Tool Suiteで実行したときに私のアプリケーションを動作させていますが、bootRepackageを使って実行可能なjarをビルドして実行した後、freemarkerビューを解決することはできません。スプリングブート実行可能なjarがフリーマーカテンプレートを解決できない
何が問題なのかよくわかりません。どんな助けもありがとう。続き
は私がログを打っていていることが確認さ
spring.http.encoding.charset=UTF-8
spring.freemarker.cache=false
spring.freemarker.charset=utf-8
spring.freemarker.check-template-location=true
spring.freemarker.content-type=text/html
spring.freemarker.enabled=true
spring.freemarker.suffix=.html
spring.freemarker.template-loader-path=classpath:/templates/,classpath:/templates/web/
マイジャー構造、
BOOT-INF
classes
com
scss
static
templates
web
story.html
app
application.properties
log4j2.xml
META-INF
org
私のコントローラ、
@Controller
public class HomeController {
@Autowired
private AppLog appLogger;
@RequestMapping("/")
public ModelAndView Index(HttpServletRequest request) {
appLogger.log(Level.ERROR,AppLogSource.Web, "Reached Controller", null);
String testAttribute = request.getAttribute("com.demo.test").toString();
Map<String, String> vm = new HashMap<String, String>();
vm.put("testAttribute", testAttribute);
return new ModelAndView("/web/story", vm);
}
}
、FreeMarkerのに関連する私のapplication.propertiesです私は問題がビューを解決することだと思うが、私は間違っている可能性があり、何か他のものを逃している可能性があります。だから、もしあなたがもっと情報を必要としたら教えてください。
もう一度おねがいします!
ベスト、 Mrunal
編集 のGradleファイル、
buildscript {
ext {
springBootVersion = '1.4.1.RELEASE'
}
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath("com.moowork.gradle:gradle-node-plugin:1.2.0")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'spring-boot'
apply plugin: 'com.moowork.node'
apply plugin: 'com.moowork.grunt'
jar {
baseName = 'testDemo'
version = '0.0.1'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
node {
version = '6.11.3'
npmVersion = '3.10.10'
download = true
}
task gruntMinifyJs(type: GruntTask){
args=['minifyJs', '--debug']
}
task gruntMinifyCss(type: GruntTask){
args=['minifyCss', '--debug']
}
task buildFrontEnd(type: GruntTask) {
args = ['default', '--debug']
}
npmInstall.dependsOn(nodeSetup)
buildFrontEnd.dependsOn(npmInstall)
gruntMinifyCss.dependsOn(npmInstall)
gruntMinifyJs.dependsOn(npmInstall)
build.dependsOn(buildFrontEnd)
configurations {
all*.exclude group: 'ch.qos.logback', module:'logback-classic'
all*.exclude group: 'ch.qos.logback', module:'logback-core'
}
dependencies {
compile('org.springframework.boot:spring-boot-devtools')
compile('org.springframework.boot:spring-boot-starter-freemarker')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-starter:1.4.1.RELEASE'){
exclude group:'org.springframework.boot', module:'spring-boot-starter-logging'
}
compile('org.springframework.boot:spring-boot-starter-jdbc'){
exclude group:'org.apache.tomcat', module:'tomcat-jdbc'
}
compile('mysql:mysql-connector-java')
compile('com.zaxxer:HikariCP-java6:2.3.13')
compile('org.springframework.boot:spring-boot-starter-log4j2:1.4.1.RELEASE')
compile('com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.8.8')
compile('com.google.zxing:core:3.3.0')
compile('org.antlr:antlr4-runtime:4.5')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
編集3、 さらにアップデート、
は、だから私は、リモートデバッガを添付し、私は春があることがわかりましたContentNegotiatingViewResolverを使用してビューをInternalResourceViewとして解決しますが、それはFreemarkerViewに適切に解決される春のツールスイートを通じて実行されます。 これは誰かが私の問題を絞り込むのに役立つことを願っています。私はデバッガを踏んで、平均時間内に他の場所に行くことができるかどうかを確認します。
@ダウンロードを参照してください。 – ddekany
残念ながら私は間違いがないので、どこに間違っているのか分からない。パッケージ化されたjarの実行時に有効にできるデバッグフラグまたはトレースフラグはありますか? – mrunal
jarファイルを解凍して、jarファイルがlibディレクトリ内にあることを確認します。 –