Giter VIP home page Giter VIP logo

Comments (19)

alissongodoi avatar alissongodoi commented on May 30, 2024 1

hi @rmpestano - Brazuca também 👍,

I have just got it working. Let me do more tests just to double check the best way to handle the Beans. Probably the AdminSession needs to be handled together with Spring Security.

Also, I am going to inject some real prime faces pages in the Template and let's see how it behaves.

Tomorrow I will try to check the admin-boot out and get the basics working, however I am not sure how to best externalise these configurations in the admin-boot for other people to reuse it.

Probably we need to declare the AdminBootStarter and the users trying to use the lib would need to extend this Java class.

So far so good!

Cheers!

from admin-template.

rmpestano avatar rmpestano commented on May 30, 2024

Hi @maxsap,

It it looks like an issue with OmniFaces dependency on CDI.

Looking at this thread it suggests OmniFaces 1.x to work with SpringBoot as it is "CDIless".

We could downgrade to OmniFaces 1.x in this project as well but there are other components that depend on CDI and may also break on a SpringBoot app.

I'm not a Spring expert but I think that is more a SpringBoot CDI integration issue.

The components of AdminTemplate that depend on CDI are the following:

AdminSession
BreadCrumbMB
LogoutMB
AdminConfig
SkinMB

from admin-template.

maxsap avatar maxsap commented on May 30, 2024

Hello @rmpestano,

Thank you for the fast response, indeed I am already using JoinFaces and tried to use your awesome template.

In an attempt to test out the template, I excluded the omnifaces version coming from adminfaces and now I am getting:

javax.faces.view.facelets.TagAttributeException: //Users/maxsap/Documents/workspace/wavy-admin/build/resources/main/META-INF/resources/index.xhtml @40,52 <ui:include src="/includes/top-bar.xhtml"> Invalid path : /includes/top-bar.xhtml
Which I am not 100% sure that its related to the CDI beans but more to where the resources are located.

After checking the beans that you specified it seems that most of them should be supported as spring should support @NamedBeans natively but cannot handle @SessionScoped
Any chance we can work on a spring specific implementation? I am more than happy to help out.

from admin-template.

rmpestano avatar rmpestano commented on May 30, 2024

Hi @maxsap,

for the include issue I think there should be a missing "top-bar.xhtml" in 'includes' folder. Both top-bar and includes are in the showcase application, not a admin-template thing. Do you have /META-INF/resources/includes/top-bar.xhtml in your app?

About the SessionScoped handle I'm very open to add a spring boot compatible solution, have you already solved this issue before? Maybe we could use Java Service loader to solve this, just wondering.

from admin-template.

rmpestano avatar rmpestano commented on May 30, 2024

Hi @maxsap,

any news? do you have a sample project to share?

cheers!

from admin-template.

alissongodoi avatar alissongodoi commented on May 30, 2024

HI all,

I added the following bean in my main Application Class and it kinds of solve the issue to load the Admin-Template.

@Bean
public AdminConfig adminConfig() {
	return new AdminConfig();
}

However I am still not able to get the template working. It looks like it renders the admin.xhtml as a template, however it does not find the source and images.

Did you have any progress on this one?

from admin-template.

alissongodoi avatar alissongodoi commented on May 30, 2024

Guys, I did some progress with the following for Spring Boot:

  1. For pom.xml:
  • Installed the joinfaces in my project (version 2.4.0)
  • Added admin-faces template to the project
  1. For application.properties. This is important otherwise your server won't load the proper CSS:
    jsf.primefaces.theme=admin
    jsf.primefaces.font-awesome=true

  2. For SpringBootApplication.java starter, you need to tell SpringBoot to scan for the Beans and ServletComponents in the package:

@ComponentScan("com.github.adminfaces") //This will scan for the Beans in the Admin Faces lib.
@ServletComponentScan("com.github.adminfaces") // This will start the filter and servlets.

If you add ComponentScan, don't also forget to add your package to be also scanned. Mine has @ComponentScans for adminfaces and my package.

  1. Beans:
    SpringBoot will complain that a Bean for the AdminSession has not been defined. Declare this in your application:
	@Bean
	public AdminSession adminSession() {
		return new AdminSession();
	}

If you want to configure the AdminConfig programatically like everything else in SpringBoot, you can also add the AdminConfig bean.

	@Bean
	public AdminConfig adminConfig() {
		return new AdminConfig();
	}

I didn't need to add the admin-faces.config file in the MEFA-INF, however you can also try it since I was able to verify that it loads properly once he ComponentScan is properly set.

I am still testing other aspects of this integration, however so far everything seems to work.

from admin-template.

rmpestano avatar rmpestano commented on May 30, 2024

Hi @alissongodoi, that's great news!

If everything is ok, would you mind to send a pull request to admin-boot?

Thank you very much for your help on this issue!

from admin-template.

rmpestano avatar rmpestano commented on May 30, 2024

É nóis hehe

So my ideia with admin-boot is to create the same admin-starter application so you can put your customization like AdminConfig bean there in some package like "config". We actually can rename it to "admin-starter-boot".

Later we can think of providing a spring-boot starter (I'm not familiar with boot ecosystem) or something users can declare as dependency in their projects, what do you think?

from admin-template.

alissongodoi avatar alissongodoi commented on May 30, 2024

I found a bizarre error with Maven.

If Maven Repository is located in a directory with space (like windows 7 First name and Surname folder schema), the code fails to locate the /admin.xhtml template.

When I moved the Maven Repository to a folder without spaces (for example, c:\m2-repo), it worked properly.

It was giving:

Invalid path : /admin.xhtml
	at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:179)
	at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
	at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
	at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:312)
	at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:371)
	at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:350)
	at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:199)
	at com.sun.faces.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:174)
	at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
	at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
	at com.sun.faces.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:161)
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:1006)
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:99)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

from admin-template.

rmpestano avatar rmpestano commented on May 30, 2024

Hi, that's really weird because template resolution is done at runtime (e.g when user access a page on browser) and maven resolves dependencies at build time.

So the only thing that comes to mind is that using a folder with spaces on maven repo you were not downloading dependencies during build...

from admin-template.

CiceroRegis-zz avatar CiceroRegis-zz commented on May 30, 2024

Hello good afternoon! I'm having the same probrema using JSF with maven. But I can not solve it yet.

from admin-template.

rmpestano avatar rmpestano commented on May 30, 2024

Hi, have you looked into admin-starter-springboot project?

from admin-template.

CiceroRegis-zz avatar CiceroRegis-zz commented on May 30, 2024

from admin-template.

rmpestano avatar rmpestano commented on May 30, 2024

Which components? What's the error?

from admin-template.

CiceroRegis-zz avatar CiceroRegis-zz commented on May 30, 2024

from admin-template.

rmpestano avatar rmpestano commented on May 30, 2024

Actually I'm working on a project outside the template,

The breadcrumb component depends on admin-template, don't know how I could help if you can't use the template. You can look into the code and try to extract its logic from BreadCrumbMB.

from admin-template.

CiceroRegis-zz avatar CiceroRegis-zz commented on May 30, 2024

from admin-template.

MahmoudOmarAbdulAzim avatar MahmoudOmarAbdulAzim commented on May 30, 2024

Hello
I get the below message any advice when using war with tomcat server
com.github.adminfaces.template.session.AdminFilter
java.lang.IllegalStateException: Unable to locate CDIProvider

from admin-template.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.