I'm new to Roo (and Java in general). I'm following Hantsy's tutorial and am running in to problems trying to create the service.
roo> service --entity ~.model.Conference --interface ~.service.ConferenceService
Command 'service --entity ~.model.Conference --interface ~.service.ConferenceService' not found (for assistance press TAB or type "hint" then hit ENTER)
addon search --requiresCommand "service" found no matches
Any ideas on why?
I'm using Roo 1.2.4 Release (no STS)
While following "Spring in Action" I encountered the same problem with Roo 1.2.4.
Try using roo> service type instead of just roo> service.
I had the same problem. The only thing I could find is this:
If you would like to use a services layer, since release 1.2.0 Roo
offers automatic service layer integration for your application.
Please refer to the service layer section in the application layering
chapter for further details.
I just built my application without running that command. That is the problem with most of the tutorials I am finding, they are out of date.
I have the same problem with Roo 1.2.4. However it works with Roo 1.2.3. So you can create the service layer in 1.2.3 and the rest in 1.2.4. It worked for me.
According to Roo 1.2.4 documentation, that command should work.
Related
Can anyone please help me on how to integrate Olingo (Odata) in a Springboot Java Appln.
I'm pretty new to Spring boot and have implemented one project and wanted it to convert to Oling (Odata).
I have gone through various resources but with a bunch of different approaches not sure how to do it the correct way.
Please let me know if some has worked on it and can guide me.
link to the project on which I applied spring-boot.
If you are trying to integrate OlingoJPA there are a couple of things you will have to do
Implement JPAServiceFactory and initializeODataJPAContext, basically this is about defining the persistence unit and entity manager
Then you can create a Spring Boot Configuration to mount your OData endpoint and initialize the EntityManagerFactory
Then you can point to your database here
An finally you can define the JPA entities you want your service to expose
The full Spring Boot + JPA project sample is located Github. Feel free to go though it, raise an issue or submit a Pull request for impalements
I am going to create simple rest service using spring 3 and hibernate 3. There is no chance for me to use higher version of spring due to legacy business component that is based on hibernate 3.
For such purposes I've tried to use SpringApplication.run, bet recieved following exception:
Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.springframework.core.io.support.SpringFactoriesLoader.loadFactoryNames
Is it possible to use spring-boot-maven-plugin with old spring version? Would be good to know any alternative ways in this direction.
Spring Boot (and all the related tools, e.g the maven plugin) expect Spring v4 and above. Please see the official documentation here.
By default, Spring Boot 1.3.2.BUILD-SNAPSHOT requires Java 7 and Spring Framework 4.1.5 or above.
What I want to do is to create a full Spring WebMVC CRUD API from database tables/Hibernate JPA entities, into an existing Maven Web Project.
What I want generate, to be precise:
Spring WebMVC controller (mapping&implementation)
The JPA entity (if not given) - ofc. using the standard generation built in to most IDEs
Spring Data JPA repository
Optionally modifying some other files (f.e. adding the entity to existing persistence.xml)
Is there a project for this?
What would be the best way to create something like this?
What I had thought about:
Standalone Java APP
Maven subgenerators
Eclipse plugin
Standard code generation methods (f.e. Acceleo plugin)
What would you suggest?
Partial Answer :
If you can generate JPA entities and Spring Data JPA Repositories, you can use Spring Data REST to expose the repositories as a full CRUD REST API.
Although Spring Roo will generate a CRUD application for you, however the code it generates is outdated. If I where starting a new project, I would definitely stay away from it (at least until a new version is released).
I suggest you take a look at JHipster which is a Yeoman that will generate a CRUD application using some of pretty hot tech (like Spring Boot, AngularJS etc.)
Besides the novelty factor of the generated code, another great feature of the project is that it is extremely active as is evident from the releases
The response is probably in this tutorial :
https://sites.google.com/site/telosystutorial/springmvc-jpa-springdatajpa
You can take a look at crud-rest-gen project which explains how to use the crud-maven-plugin to generate :
the CRUD Rest API
the documentation of the API
the HTML5/AngularJS CRUD Administration UI
the Rest API for retrieving audit information and associated unit tests if you use Hibernate Envers to audit your entities
All you have to provide is the data model containing the JPA entities.
Spring-roo (link) have these features, and if you want you can remove spring-roo from your project and remains a java-spring project.
Sample from link :
roo> hint
roo> project --topLevelPackage com.foo
roo> jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY
roo> entity jpa --class ~.Timer --testAutomatically
roo> field string --fieldName message --notNull
roo> hint web mvc
roo> web mvc setup
roo> web mvc all --package ~.web
roo> selenium test --controller ~.web.TimerController
roo> web gwt setup
roo> web gwt all --proxyPackage ~.client.proxy --requestPackage ~.client.request
roo> perform tests
roo> quit
As you can see : create the project, setup jpa provider, create Entity, create MVC Controller, the Tests and some GWT setup.
A Yeoman generator for generating Microservices with SpringBoot in Hexagonal Architecture
https://www.npmjs.com/package/generator-springboot-hexagonal
I am new to Spring portlet i am unable to run a sample spring portlet project.. I am trying to run the project from eclipse as run on server on jboss server. My questions are 1. How can we run a portlet project. Do i need some kind of portlet container(I have no idea of this container i just know few names like liferay etc)?? I cant find a full documented example any where.. In Spring mvc based on the request mapping i can call that purticular Controller class but in Spring mvc portlet how can we call this controllers( or Portlets). Is it possible to call a portlet directly by an url?? The sample project is deployed without any error but i cant find a way by which i can call or trigger a portlet. Any help would be much appriciated.
thx
nkovi
Yes, you will need to deploy to a portlet container like Liferay etc, or uPortal. Once you have the portlet container up and running, things should hopefully become more obvious.
Regarding your other questions, I strongly suggest you read some documentation - the Spring portlet docs are not too bad although they are a little behind on annotations.
I mean to say like for html/css/jquery etc. we have w3schools like that is there any web site or e-material for starting up with spring and spring security.
I recommend the spring security documentation getting start steps.
http://static.springsource.org/spring-security/site/start-here.html
I would suggest going through this tutorial to see a concrete implementation:
http://krams915.blogspot.com/2010/12/spring-security-mvc-integration.html (Part 1)
http://krams915.blogspot.com/2010/12/spring-security-mvc-integration_18.html (Part 2)
It provides a description and example of every file you'll have to set up, and a download of the tutorial project at the end of each tutorial.