相关疑难解决方法(0)

JSF注释不适用于Spring-boot

我曾尝试使用Spring Boot和JSF/Primefaces/Richfaces中的信息,但对我来说它不起作用.

我使用 Java 8,maven,Spring-boot和JSF与PrimeFaces.我想有可执行jar并通过main方法或命令行运行我的应用程序java -jar myApp.jar.

问题 - JSF-annotations(@ManagedBean,@ManagedProperty)被忽略.

Pom文件:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.1.3.RELEASE</version>
</parent>

<dependencies>
   <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-core</artifactId>
        <version>7.0.54</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-logging-juli</artifactId>
        <version>7.0.54</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-jasper</artifactId>
        <version>7.0.54</version>
    </dependency>

    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>5.0</version>
    </dependency>

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-api</artifactId>
        <version>2.2.7</version>
    </dependency>

    <dependency>
        <groupId>com.sun.faces</groupId>
        <artifactId>jsf-impl</artifactId>
        <version>2.2.7</version>
    </dependency>
    ...
</dependencies>
Run Code Online (Sandbox Code Playgroud)

我也尝试添加/删除javax.el-api/javax.el/jstl - 结果相同.对于bean初始化,我已将部分添加到faces-config.xml

当我将spring-boot-starter-web更改为spring-boot-starter并拥有spring-web(根据Herick提到的解决方案)我得到了

java.io.FileNotFoundException:类路径资源[org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.class]无法打开,因为它不存在

我的配置类:

@Configuration
@EnableAutoConfiguration//(exclude = {WebMvcAutoConfiguration.class, DispatcherServletAutoConfiguration.class})
@ComponentScan("hello")
public …
Run Code Online (Sandbox Code Playgroud)

jsf spring spring-boot

9
推荐指数
1
解决办法
5018
查看次数

Spring Boot和JSF/Primefaces/Richfaces

我已经与Spring联系了几个月,最近在浏览指南部分时遇到了Spring Boot.这些指南非常容易完成,可以很好地初步掌握项目的基本(和令人敬畏的)想法,即能够以最少的配置构建和部署企业级应用程序,同时支持各种Spring/JEE良好做法.我真的很感兴趣将Spring Boot用于测试项目,因为使用它可以更容易,更快地设置和运行,并且仍然非常接近我的生产环境.我目前正在尝试使用Spring Boot和Primefaces构建一个项目作为我选择的视图技术,但是这个设置显然不像Thymeleaf那样开箱即用,因为它在类路径中具有二进制文件足够.我尝试包含以下gradle/maven工件,但没有成功:

  • primefaces
  • JSF的API
  • JSF的IMPL
  • EL-API

Spring Boot的嵌入式Tomcat服务器启动时没有明显错误,但在尝试在浏览器中打开/ view等页面后,嵌入式服务器显示以下错误消息: HTTP Status 500 - Circular view path: would dispatch back to the current handler URL again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)

在几个不同的地方搜索后,我仍然找不到任何关于如何设置这样一个项目的资源/教程.以下是我的build.gradle文件的内容:

buildscript {
    repositories {
        maven { url "http://repo.spring.io/libs-snapshot" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.0.RC4")
    }
}

apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'spring-boot'

idea {
    module {
        downloadJavadoc = true
    } …
Run Code Online (Sandbox Code Playgroud)

jsf spring primefaces spring-boot

7
推荐指数
2
解决办法
2万
查看次数

Spring Boot JSF集成

环境 :

雄猫8

Spring Boot 1.5

JSF 2.2

Apache MyFaces

Spring MVC

代码:

我在Servlet 3.0环境中集成了Spring Boot和JSF 2.2.

配置类:

JSFConfig.java - JSF的配置.

@Configuration
@ComponentScan({"com.atul.jsf"})
public class JSFConfig {

        @Bean
        public ServletRegistrationBean servletRegistrationBean() {
            FacesServlet servlet = new FacesServlet();
            return new ServletRegistrationBean(servlet, "*.jsf");
        }

}
Run Code Online (Sandbox Code Playgroud)

Spring Boot主类:

@SpringBootApplication
@Import({ // @formatter:off 
    JPAConfig.class,
    ServiceConfig.class, // this contains UserServiceImpl.java class.
    WebConfig.class,
    JSFConfig.class,
})
public class SpringbootJpaApplication extends SpringBootServletInitializer{

    public static void main(String[] args) {
        SpringApplication.run(SpringbootJpaApplication.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
            return …
Run Code Online (Sandbox Code Playgroud)

spring jsf-2 jsf-2.2 spring-boot

7
推荐指数
1
解决办法
7616
查看次数

将JSF托管bean注释与Spring Boot集成

我在JSF 2.2中使用Spring启动.我的问题是我可以创建@ManagedBean,javax.annotation.ManagedBean当我运行应用程序时它在我的index.xhtml中工作,但是当我想使用时javax.faces.bean.ManagedBean不显示值.这两者有什么区别?为什么我不能用 javax.faces.bean.ManagedBean?(我没有web.xml文件,所有都在类中配置)

jsf spring managed-bean spring-boot

1
推荐指数
1
解决办法
2385
查看次数

标签 统计

spring ×4

spring-boot ×4

jsf ×3

jsf-2 ×1

jsf-2.2 ×1

managed-bean ×1

primefaces ×1